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

Overview

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: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:

<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:

<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

<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" />

######Rectangle Button

rectangle button

<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" />

######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" />
</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" />

####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" />

######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" />

####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" />

######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" />

######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" />

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" />

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"
                 />

######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"/>

##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

// 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();
Comments
  • How to fix the problem

    How to fix the problem "Attribute "rippleColor" has already been defined" ?

    Hi,

    I face the trouble with Error:(1) Attribute "rippleColor" has already been defined since I also use MaterialNavigationDrawer library.

    It seems there is confict with these two repositories in terms of some defined attributes.

    opened by willowcheng 21
  • Button Float NoClassDefFoundError

    Button Float NoClassDefFoundError

    I get this error when i use button float in the last version of the library java.lang.NoClassDefFoundError: Failed resolution of: Lcom/nineoldandroids/view/ViewHelper; at com.gc.materialdesign.views.ButtonFloat$1.run(ButtonFloat.java:113) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5223) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.nineoldandroids.view.ViewHelper" on path: DexPathList[[zip file "/data/app/com.it.university.lbu-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:469)             at com.gc.materialdesign.views.ButtonFloat$1.run(ButtonFloat.java:113)             at android.os.Handler.handleCallback(Handler.java:739)             at android.os.Handler.dispatchMessage(Handler.java:95)             at android.os.Looper.loop(Looper.java:135)             at android.app.ActivityThread.main(ActivityThread.java:5223)             at java.lang.reflect.Method.invoke(Native Method)             at java.lang.reflect.Method.invoke(Method.java:372)             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693) Suppressed: java.lang.ClassNotFoundException: com.nineoldandroids.view.ViewHelper at java.lang.Class.classForName(Native Method) at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at java.lang.ClassLoader.loadClass(ClassLoader.java:504) ... 10 more Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

    opened by arafeh94 15
  • How to change the text of buttons in dialog

    How to change the text of buttons in dialog

    Hi there,

    I want to change the text of the buttons in the dialog but can't find an easy way to do that. Do I really need to create two ButtonFlat Objects for that or is there an easier way to achieve what I want to do?

    opened by mehrad-rafigh 13
  • error: Error parsing XML: unbound prefix

    error: Error parsing XML: unbound prefix

    Hi. I have a series of problems at the time of use the element of Android L; in specifically the error: "Error parsing XML: unbound prefix Material Design Android Library" in my views. sorry for my bad english.

    error parsing xml unbound prefix

    opened by libredesarrollo 13
  • change animation time for button

    change animation time for button

    The action under onClickListener can only be triggered after ripple effect finished. So, I would like to change animation time because its very slow in some devices thanks.

    opened by abhi9 11
  • Import project to Android Studio

    Import project to Android Studio

    Good morning to You,

    I cant import this project. I try everythink that i thought will work. Browse through stackoverflow, multiple google pages and still i am stuck.

    Can anyone tell me how to import this lib to my project ?

    I use Android Studio 1.0 RC 4.

    opened by WojciechCz 11
  • Can't set the text of buttons in dialog

    Can't set the text of buttons in dialog

    Hi, I am using your library and my app depends a lot on it. I'm currently not able to set custom text on Accept and Cancel of dialog. I tried setting

          ButtonFlat acceptButton = dialog.getButtonAccept();
          acceptButton.setText("Accept Me!");
    

    I get the error: Attempt to invoke virtual method 'void com.gc.materialdesign.views.ButtonFlat.setText(java.lang.String)' on a null object reference

    I followed your guide. Also, I followed on the same issue faced by another developer. Can you please help me solve this issue?

    opened by SilleBille 6
  • Setting an action to the button rectangle crashes the app!

    Setting an action to the button rectangle crashes the app!

    I have just directly copied the button from your code and replaced a button on my app with it with the button id. But now the app crashes, please let me know what needs to be done..

    opened by MelodyAustin 6
  • How do we get the value for the slider?

    How do we get the value for the slider?

    im trying to load the slider in a dialog,but i cant seem to find how to get the value from the slider. ive tried using the setOnValueChangedListener but that keeps throwing a null pointer exception. how would i solve this problem and get the value from a slider

    opened by clinton2111 6
  • Unable to use Dialog Widget

    Unable to use Dialog Widget

    I have below code written in my fragment to use Dialog Widget, but it always throws NullPointerException when I try to show dialog with dialog.show

    Code within Fragment:

    Dialog dialog = new Dialog(MyActivity.getLoginRegisterActivityInstance(), "Account locked!", result.getErrorMessage());
    dialog.setCancelable(false);
    dialog.setOnAcceptButtonClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
                      FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
                      ft.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out);
                      ft.replace(R.id.logincontent, new RegisterFragment(), null);
                      ft.commit();
               }
    });
    ButtonFlat acceptButton = dialog.getButtonAccept();
    acceptButton.setText("Ok");
    ButtonFlat cancelButton = dialog.getButtonCancel();
    cancelButton.setVisibility(View.GONE);
    dialog.show(); //Exception here
    

    What could be the possible reason?

    opened by kshkrao3 5
  • NoClassDefFoundError

    NoClassDefFoundError

    I got this error on using the Float Action Button java.lang.NoClassDefFoundError: com.nineoldandroids.view.ViewHelper at com.gc.materialdesign.views.ButtonFloat$1.run(ButtonFloat.java:108)

    opened by chnsh 5
  • Migrated to AndroidX, can't build anymore

    Migrated to AndroidX, can't build anymore

    I migrated to AndroidX and ever since then MaterialDesignLibrary prevents me from building successfully. I currently keep getting this error which I don't get when I comment out MaterialDesignLibrary from my gradle file.

    ERROR: Unable to resolve dependency for ':app@googlePlayFlavorDebug/compileClasspath': Could not resolve com.android.support:support-v4:22.+.

    opened by taar1 0
  •  import com.gc.materialdesign.views.checkView; ,  setCheckedNoAnim(**)  & setChecked() not working

    import com.gc.materialdesign.views.checkView; , setCheckedNoAnim(**) & setChecked() not working

    i trying to work my old program new update but import com.gc.materialdesign.views.checkView; , setCheckedNoAnim(**) & setChecked() not working

    plz help me what can i do

    opened by hemrajpatil 0
Releases(1.3)
Owner
Ivan Navas
Ivan Navas
Android Material Design Components

Android-Material-Design-Components Material design is a comprehensive guide for visual, motion, and interaction design across platforms and devices. G

Velmurugan Murugesan 3 Jun 10, 2022
Modular and customizable Material Design UI components for Android

Material Components for Android Material Components for Android (MDC-Android) help developers execute Material Design. Developed by a core team of eng

Material Components 14.4k Dec 31, 2022
The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.

MaterialDrawer ... the flexible, easy to use, all in one drawer library for your Android project. What's included ?? • Setup ??️ • Migration Guide ??

Mike Penz 11.6k Dec 27, 2022
A Material Design ViewPager easy to use library

MaterialViewPager Material Design ViewPager easy to use library Sample And have a look on a sample Youtube Video : Youtube Link Download In your modul

Florent CHAMPIGNY 8.2k Jan 1, 2023
Material You interface with dynamic theme support for your Android projects

Material You Sample Material You interface with dynamic theme support for your Android projects Requirements Android Studio Chipmunk 2021.2.1 or highe

aospstudio 3 Jul 28, 2022
Material You Theme for Frames Dashboard

Material You Theme for Frames Dashboard Frames Dashboard Copy everything into your Frames project, edit colors, corner radius... Use compileSdk = 31 V

pashapuma 8 Dec 14, 2022
A straightforward, no-BS compass app with support for Material You themes 🧭

Compass A simple & straightforward, no-BS compass app that works with your Material You colors! Motivation I do security work as a fourth job and havi

Synapse Technologies, LLC 16 Nov 23, 2022
📱Android Library to implement animated, 😍beautiful, 🎨stylish Material Dialog in android apps easily.

Material Dialogs for Android ?? ?? Android Library to implement animated, ?? beautiful, ?? stylish Material Dialog in android apps easily. 1. Material

Shreyas Patil 875 Dec 28, 2022
Material Shadows for android : A library for supporting convex material shadows

MaterialShadows A library for seamlessly integrating Material shadows. The library takes existing material shadows to next level by adding the followi

Harjot Singh Oberai 2.2k Dec 19, 2022
An Android library aimed to get the beautiful CardViews that Google shows at its official design specifications

MaterialList Discontinued This library will not receive any updates, as I do not have the time or knowledge to improve it. If anyone forks it and want

null 1.6k Nov 29, 2022
[] Android Library that implements Snackbars from Google's Material Design documentation.

DEPRECATED This lib is deprecated in favor of Google's Design Support Library which includes a Snackbar and is no longer being developed. Thanks for a

null 1.5k Dec 16, 2022
Default colors and dimens per Material Design guidelines and Android Design guidelines inside one library.

Material Design Dimens Default colors and dimens per Material Design guidelines and Android Design guidelines inside one library. Dimens Pattern: R.di

Dmitry Malkovich 1.4k Jan 3, 2023
A library support form with material design, construct same with Android UI Framework

SwingUI A slight Java Swing library support form with material design, construct same with Android UI Framework writen in Kotlin Supported: 1. Screen:

Cuong V. Nguyen 3 Jul 20, 2021
ToggleIconView is a collection library of animated two-stage toggle icons for Android.

ToggleIconView ToggleIconView is a collection library of animated two-stage toggle icons for Android. Installation JitPack repository // Project level

Özgür Görgülü 6 Sep 10, 2022
Library containing over 2000 material vector icons that can be easily used as Drawable or as a standalone View.

Material Icon Library A library containing over 2000 material vector icons that can be easily used as Drawable, a standalone View or inside menu resou

null 2.3k Dec 16, 2022
MaterialPickers-in-android - A simple android project that shows how to create material pickers for date and time

MaterialPickers-in-android A simple android project that shows how to create mat

Segun Francis 2 Apr 28, 2022
😍 A beautiful, fluid, and extensible dialogs API for Kotlin & Android.

Material Dialogs View Releases and Changelogs Modules The core module is the fundamental module that you need in order to use this library. The others

Aidan Follestad 19.5k Dec 31, 2022
Floating Action Button for Android based on Material Design specification

FloatingActionButton Yet another library for drawing Material Design promoted actions. Features Support for normal 56dp and mini 40dp buttons. Customi

Zendesk 6.4k Dec 26, 2022
Implementation of Ripple effect from Material Design for Android API 9+

RippleEffect ExpandableLayout provides an easy way to create a view called header with an expandable view. Both view are external layout to allow a ma

Robin Chutaux 4.9k Dec 30, 2022