Material Design

Material design is a comprehensive guide for visual, motion, and interaction design across platforms and devices.

material design functionality available in Android 5.0 (API level 21) and above.



How to create material design theme?

1.Open res -> values -> colors.xml and add the below color values

1 styles.xml under res->values,add below code,The styles defined in this styles.xml are common to all the android versions.


3.Now under res,Create a folder names  values-v21,Inside  values-v21,create another styles.xml,add below code ,This is specific to Android Lollipop only.


4.Now open  AndroidManifest.xml,modify the android:theme attribute of  tag.


5.How to add Toolbar(Action Bar)?

5.1.Create an xml file named toolbar.xml under res layout
5.2.Use toolbar.xml inside activity_main.xml.
5.3.Make sure your activity extends AppCompatActivity
5.4. Get reference of  toolbar inside oncreate().and then call setSupportActionBar() by passing the toolbar object.After doing this,run your app,you must get this screen.


6.How to add menus to toolbar?

6.1.To import image Asset in Android Studio, right click on res New Image Asset. It will show you a popup window to import the resource, select Action Bar and Tab Icons as Icon Type and Clip Art as Asset Type,Click on Icon which is near to Clip Art, Select Icon and proceed.


6.2.Once Icon is imported,open menu_main.xml located under res ⇒ menu and add new menu your must get screen which is added below.


You can find Sample code in the following link