Thursday, April 25, 2013

Solution: Actionbar Space or Padding between homeasupindicator and app icon

Actionbar support starts from android version 3.0+

If you want to apply style for actionbar then add values-v11 is the values of the API version 11, and values-v14 is the values of the API version 14 in the res folder/ when your minSdkVersion is less than 11.
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="11" />

Using Themes, getting space between homeAsUpIndicator and App Icon is not working but it is possible through programatically.

android:homeAsUpIndicator : Specifies a drawable to use for the 'home as up' indicator.

programatically:
setDisplayHomeAsUpEnabled(true) shows the "<" on the action bar.

Style:
android:homeAsUpIndicator allows to change the icon

<item name="homeAsUpIndicator">@drawable/custom_home</item>



Solution:
Access the homeAsUpIndicator from the app by calling the android.R.id.home.
Change padding so that we will get space between homeAsUpIndicator and App Icon.
((ImageView) android.R.id.home).setPadding(7,0,7,0)