I'm using sherlocklibrary to show action bar in my application,it works fine but when i put background image for the header a black area appears at the right side (See the snapshot).
How can change the background color of the menu button or at least fill parent the header image.
And i'm updating this image at run time according to the user choice.
This is my title bar layout.
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/headerLinear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<ImageView
android:id="@+id/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
/>
<TextView
android:id="@+id/title"
style="@style/titleStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/logo"
android:maxLength="30"
android:ellipsize="end"
android:text="@string/login_en" />
</RelativeLayout>
And i put this code in my activity:
BitmapDrawable bg = (BitmapDrawable) getResources().getDrawable(R.drawable.bg_striped_split);
getSupportActionBar().setBackgroundDrawable(bg);
LayoutInflater inflater = LayoutInflater.from(this);
View customView = inflater.inflate(R.layout.title_bar, null);
RelativeLayout header = (RelativeLayout) customView.findViewById(R.id.headerLinear);
header.setBackgroundDrawable(R.drawable.header);
I tried this and it remove the black area appearance from the right side.. check the complete code here
getSupportActionBar().setDisplayShowHomeEnabled(false);
getSupportActionBar().setDisplayShowTitleEnabled(false);
// ActionBar actionBar = getSupportActionBar();
getSupportActionBar().setCustomView(R.layout.actionbar_top); // load
// your
// layout
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
Image