The Android ActionBar is now easier to customise than ever, due to the fact that the old ActionBar element has been replaced with the more versitile Toolbar. Since Toolbarinherits directly from ViewGroup, you can essentially style or add any element you want to the ActionBar. That is, with the exception of a few gotchas, but you’re in luck because this article is here so you don’t get got!

Just a foreward to say that this article makes the assumption that you are using the support library – and if you’re not then you’re only targeting about 10% of devices which is more than a little strange.

OK, let’s code.

Below is the completed Toolbar layout. Go ahead and add it to your project, and you can make changes from there.

 

http://sourcey.com/android-custom-centered-actionbar-with-material-design/

Advertisements