Action bar color dynamically. Sometimes it is necessary to change the Action Bar and status bar color dynamically. This project shows how it can be achieved simply. Status bar color change is supported for lollipop and  above devices. So the project works by checking build versions of the device.Only action-bar color is can be changed for devices below lollipop and both action bar and status-bar color are changeable for devices above lollipop, else app crashes. To give an overview activity contain three seek-bars each representing the primary colors Red,Blue and Green. The goal is to create our required color by combining these colors. For the first step is to check the build version of the device. if it’s below lollipop the default color is set, and  if it’s above lollipop default status-bar color also applied.

Changes made to the seek-bar are being saved so when you reopen the app the color is the last one you selected. You can modify the code as you like “link to source code is down below”.  Now straight to code because it’s simple and nothing more to say about it.

DOWNLOAD HERE

 

action-bar-color logicchip.com full

MainActivity.java

Now for the activity xml part

activity_main.xml

 

 

Categories: Android

Leave a Reply

%d bloggers like this: