Android Textile Pattern Actionbar/App Bar: How To Brand Custom Actionbar

Posted on 5 views
Google focused on cloth blueprint inward the novel operating organisation Android 5.0 (lollipop). After unloose of Android 5.0, almost all Google apps choose been already updated amongst the role of cloth design. Not solely Google, others developers also updated their application because practiced blueprint makes practiced users experience. Material blueprint brings a lot of novel features as well as inward this article I volition clarify how to implement material blueprint App Bar/Action Bar, forthwith ActionBar has been replaced amongst Toolbar/App Bar. We role Toolbar every bit ActionBar inward android application.

 Google focused on cloth blueprint inward the novel operating organisation Android  Android Material Design ActionBar/App Bar: How to Make Custom ActionBar

Related:
Android Navigation Drawer View: Material Design Support Library
Android Toolbar Example: How to Use Toolbar every bit ActionBar


How to Implement Material Design ActionBar/App Bar to Android App

 

 Google focused on cloth blueprint inward the novel operating organisation Android  Android Material Design ActionBar/App Bar: How to Make Custom ActionBar
Android Material Design ActionBar Color

Before jumping to our coding part, let’s beak most the color scheme. In this image, you lot tin run across around useful places to modify app color to brand maderial blueprint app bar. Here, we’ll alter color of colorPrimary, colorPrimaryDark as well as textColorPrimary. colorPrimary denotes primary color of your app as well as used inward ActionBar/App Bar, colorPrimaryDark used every bit condition bar color as well as textColorPrimary primary text color of your application respectively.

Material blueprint helps android developer to brand their application professional person looking. You choose to add together appcompact every bit a dependency inward your build.gradle file to implement cloth blueprint actionbar/app bar. Let’s showtime past times adding appcompact back upwards library inward your build.gradle file.

dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.2.0' }

Add Color Attribute

You choose to create colors.xml file inward your values folder to add together color attribute as well as thus your colors.xml file looks similar this.
res/values/colors.xml

Change Your App Theme

You choose to alter your application subject to brand cloth blueprint activeness bar. Your styses.xml file seems similar this.
res/values/styles.xml

Add Toolbar to Your Activity File

Toolbar is similar other android ViewGroup, you lot tin add together Toolbar within your activity layout straight or brand divide layout as well as include that within your layout. After adding Toolbar, activity layout volition facial expression similar this.
res/layout/activity_main.xml

Modify Your Java Activity File

To brand Toolbar working similar an Action Bar, you lot choose to add together ii lines of code to your activity file as well as activity file looks similar this.
src/MainActivity.java

Add Menu Items

Finally, nosotros choose non added carte du jour especial inward toolbar/app bar. TO add together carte du jour especial inward your app, only add together carte du jour especial within your carte du jour file. Don’t forget to add together carte du jour especial icons ic_action_search as well as ic_action_share inward your drawable folder.
res/menu/menu_main.xml

And update your string.xml file.
res/values/strings.xml

<resources> <string name="app_name">Material Design ActionBar</string> <string name="hello_world">Android Material Design App Bar/ActionBar</string> <string name="action_settings">Settings</string> <string name="action_share">Share</string> <string name="action_search">Search</string> </resources>

 Google focused on cloth blueprint inward the novel operating organisation Android  Android Material Design ActionBar/App Bar: How to Make Custom ActionBar
Android Material Design ActionBar/App bar

We choose done all things. Now, run your cloth blueprint actionbar application that looks what nosotros expected.