Skip to main content


Showing posts from June, 2017

Actionbar and toolbar using support library

Action bar has been our friend since a long time. But it has its own drawbacks. You can not change its color, or size or appearance of its elements.

So came toolbar in android Lollipop. The beauty of this is, you add a toolbar like any other item in the layout xml file, set its color, size, position. Then add a few lines of code to make it an action bar.

So let us dive straight into coding.

I am using support library for toolbar and also appcompat activity. If you do not want to bother about devices with older versions than 5.0, you can straight use toolbar.

You can find toolbar in appcompat option in Android studio design view of your xml file.

So you insert that toolbar in the layout xml file.

<?xml version="1.0" encoding="utf-8"?><LinearLayoutxmlns:android=""android:orientation="vertical"android:layout_width="match_parent" android:layout_margin="10dp"android:layout_heig…