Github url

MaterialDesignLibrary

by navasmdc

This is a library with components of Android L to you use in android 2.2

9.1K Stars 2.4K Forks Last release: over 5 years ago (1.3) Apache License 2.0 74 Commits 3 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Material design library logo

Material Design Android Library

Android app on Google Play

Android Arsenal

How to use

If you want use this library, you only have to download MaterialDesign project, import it into your workspace and add the project as a library in your android project settings.

If you prefer it, you can use the gradle dependency, you have to add these lines in your build.gradle file:

repositories { jcenter() } dependencies { compile 'com.github.navasmdc:MaterialDesign:[email protected]' }

Some components have custom attributes, if you want use them, you must add this line in your xml file in the first component:

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:materialdesign="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent">
</relativelayout>

If you are going to use a ScrollView, it is recommended that you use the CustomScrollView provided in this library to avoid problems with the custom components. To use this component:

xml<com.gc.materialdesign.views.scrollview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:materialdesign="http://schemas.android.com/apk/res-auto" android:id="@+id/scroll" android:layout_width="match_parent" android:layout_height="match_parent">
</com.gc.materialdesign.views.scrollview>

Components

Buttons

Flat Button

flat button

xml<com.gc.materialdesign.views.buttonflat android:id="@+id/buttonflat" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#1E88E5" android:text="Button"></com.gc.materialdesign.views.buttonflat>
Rectangle Button

rectangle button

xml<com.gc.materialdesign.views.buttonrectangle android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#1E88E5" android:text="Button"></com.gc.materialdesign.views.buttonrectangle>
Float Button

float button

It is recommended to put this component in the right-bottom of the screen. To use this component write this code in your xml file. If you don`t want to start this component with animation set the animate attribute to false. Put your icon in the icon attribute to set the drawable icon for this component.

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:materialdesign="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent">
    <!-- ... XML CODE -->
    <com.gc.materialdesign.views.buttonfloat android:id="@+id/buttonFloat" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentright="true" android:layout_alignparentbottom="true" android:layout_marginright="24dp" android:background="#1E88E5" materialdesign:animate="true" materialdesign:icondrawable="@drawable/ic_action_new"></com.gc.materialdesign.views.buttonfloat>
</relativelayout>
Float small button

float small button

<com.gc.materialdesign.views.buttonfloatsmall android:id="@+id/buttonFloatSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#1E88E5" materialdesign:icondrawable="@drawable/ic_action_new"></com.gc.materialdesign.views.buttonfloatsmall>

Switches

CheckBox

checkbox

<com.gc.materialdesign.views.checkbox android:id="@+id/checkBox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#1E88E5" materialdesign:check="true"></com.gc.materialdesign.views.checkbox>
Switch

switch

<com.gc.materialdesign.views.switch android:id="@+id/switchView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#1E88E5" materialdesign:check="true"></com.gc.materialdesign.views.switch>

Progress indicators

Progress bar circular indeterminate

progress bar circular indeterminate

<com.gc.materialdesign.views.progressbarcircularindeterminate android:id="@+id/progressBarCircularIndeterminate" android:layout_width="32dp" android:layout_height="32dp" android:background="#1E88E5"></com.gc.materialdesign.views.progressbarcircularindeterminate>
Progress bar indeterminate

progress bar indeterminate

<com.gc.materialdesign.views.progressbarindeterminate android:id="@+id/progressBarIndeterminate" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#1E88E5"></com.gc.materialdesign.views.progressbarindeterminate>
Progress bar indeterminate determinate

Progress bar indeterminate determinate

<com.gc.materialdesign.views.progressbarindeterminatedeterminate android:id="@+id/progressBarIndeterminateDeterminate" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#1E88E5"></com.gc.materialdesign.views.progressbarindeterminatedeterminate>

If you begin progrees, you only have to set progress it

progressBarIndeterminateDeterminate.setProgress(progress);
Progress bar determinate

Progress bar determinate

<com.gc.materialdesign.views.progressbardeterminate android:id="@+id/progressDeterminate" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#1E88E5"></com.gc.materialdesign.views.progressbardeterminate>

You can custom max and min progress values with

materialdesign:max="50"

and

materialdesign:min="25"

attributes.

Slider

Slider

<com.gc.materialdesign.views.slider android:id="@+id/slider" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#1E88E5" materialdesign:max="50" materialdesign:min="0"></com.gc.materialdesign.views.slider>
Slider with number indicator

Slider with number indicator

<com.gc.materialdesign.views.slider android:id="@+id/slider" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#1E88E5" materialdesign:max="50" materialdesign:min="0" materialdesign:shownumberindicator="true"></com.gc.materialdesign.views.slider>

Widgets

SnackBar

Snackbar

SnackBar snackbar = new SnackBar(Activity activity, String text, String buttonText, View.OnClickListener onClickListener); snackbar.show();

If you don't want to show the button, put

null

in

buttonText

attribute

Dialog

Dialog

Dialog dialog = new Dialog(Context context,String title, String message); dialog.show();

You can set the accept and cancel button on the event listener or change it's text

java // Set accept click listenner dialog.setOnAcceptButtonClickListener(View.OnClickListener onAcceptButtonClickListener); // Set cancel click listenner dialog.setOnCancelButtonClickListener(View.OnClickListener onCancelButtonClickListener); // Acces to accept button ButtonFlat acceptButton = dialog.getButtonAccept(); // Acces to cancel button ButtonFlat cancelButton = dialog.getButtonCancel();

Color selector

Color selector

ColorSelector colorSelector = new ColorSelector(Context context,int intialColor, OnColorSelectedListener onColorSelectedListener); colorSelector.show();

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.