Android 4.4 Kitkat Custom View Actionbar Not Filling The Whole Width
I am trying to have a Simple actionbar with a custom view, but I get the following result: For demonstration I created a simple xml with a yellow background color which is supposed
Solution 1:
The solution is adding :
actionBar.setDisplayShowTitleEnabled(false);
The code should look something like:
actionBar = getSupportActionBar();
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setCustomView(R.layout.actionbar);//set the custom view
Solution 2:
@NemesisDoom: Please make sure that you use ActionBar from the support.v7 library rather that one from the Android API (this second one will not work certainly). If still doesn't work, add the further changes:
styles.xml (your action bar style section):
<item name="android:homeAsUpIndicator">@drawable/_pixel</item>
<item name="homeAsUpIndicator">@drawable/_pixel</item>
_pixel is 1x1.png image, transparent.
your activity:
actionBar.setDisplayHomeAsUpEnabled(true);
Post a Comment for "Android 4.4 Kitkat Custom View Actionbar Not Filling The Whole Width"