navasmdc /MaterialDesignLibrary
This is a library with components of Android L to you use in android 2.2
★ 8,908⑂ 2,181👁 495⑃ 93● 337▤ 3
+0
日增长
8,908
stars
2,181
forks
495
watchers
93
prs
337
issues
3
releases
README
!Material design library logo
Material Design Android Library
How to use
Components
Buttons
Flat Button
Rectangle Button
Float Button
Float small button
Switches
CheckBox
Switch
Progress indicators
Progress bar circular indeterminate
Progress bar indeterminate
Progress bar indeterminate determinate
Progress bar determinate
Slider
Slider with number indicator
Widgets
SnackBar
Dialog
Color selector
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:
xml
repositories {
jcenter()
}
dependencies {
compile 'com.github.navasmdc:MaterialDesign:1.5@aar'
}
Some components have custom attributes, if you want use them, you must add this line in your xml file in the first component:
xml
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
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"
Components
Buttons
Flat Button
!flat button
xml
Rectangle Button
!rectangle button
xml
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 dont 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.
xml
Float small button
!float small button
xml
Switches
CheckBox
!checkbox
xml
Switch
!switch
xml
Progress indicators
Progress bar circular indeterminate
!progress bar circular indeterminate
xml
Progress bar indeterminate
!progress bar indeterminate
xml
Progress bar indeterminate determinate
!Progress bar indeterminate determinate
xml
If you begin progrees, you only have to set progress it
java
progressBarIndeterminateDeterminate.setProgress(progress);
Progress bar determinate
!Progress bar determinate
xml
You can custom max and min progress values with materialdesign:max="50" and materialdesign:min="25" attributes.
Slider
!Slider
xml
Slider with number indicator
!Slider with number indicator
xml
Widgets
SnackBar
!Snackbar
java
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
jaTop issues
#274Attribute rippleColor is defined in the new design support library34 comments · 2015-05-30#355Multiple defined rippleColor attr when compile 'com.android.support:design21 comments · 2015-11-05#317Cannot use with android support design library19 comments · 2015-08-02#199CheckBox setChecked() not working18 comments · 2015-03-23#289Conflict with support library16 comments · 2015-06-15#368Error rippleColor has already been defined12 comments · 2015-12-31#60ButtonRectangle not worked with style12 comments · 2014-12-04#127setChecked not working11 comments · 2015-01-26