@Arya gave a good example using styles.xml:
<style name="BaseTheme" parent="Theme.AppCompat.NoActionBar"> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <item name="homeAsUpIndicator">@drawable/menu</item> <item name="android:textColorPrimary">@android:color/white</item> </style>
You can also do this programmatically:
public void setTitle(String title, int homeAsUpIndicator) { if (getSupportActionBar() != null) { getSupportActionBar().setTitle(title); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeAsUpIndicator(homeAsUpIndicator); } }
Then, in your onCreate () method, you can call the setTitle method with up indicator ican as a resource.
NOTE. uses a support action bar with a new toolbar.
Ray hunter
source share