you make custom Action-bar and possible to change its icon for a custom.
Follow this Steps:
Only possible for this to make Custom Sherlock bar for Title.
create separate xml file for title on App.
that file contains like this..
In this custom layout, we can able to change the background color and custom icon..
you just add the image from drawable to that header_sherlock.xml file button coding part like
android:background="@drawable/imageName"
header_sherlock.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="3"
android:background="#008000"
>
<Button
android:id="@+id/header_tvleft"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="left"
android:layout_marginTop="@dimen/margintop"
android:clickable="true"
android:paddingLeft="@dimen/layoutpaddingleft"
android:text="Back"
android:background="@drawable/imageName"
android:textColor="#ffffff"
android:textSize="@dimen/header_leftbtn"
/>
<Button
android:id="@+id/header_tvcenter"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:layout_marginTop="@dimen/margintop"
android:layout_marginRight="@dimen/sherlockpaddingright"
android:layout_marginLeft="@dimen/sherlockpaddingleft"
android:text="Center"
android:textColor="#ffffff"
android:textStyle="bold"
android:background="@drawable/save1"
android:textSize="@dimen/header_title"
/>
<Button
android:id="@+id/header_tvright"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="right"
android:layout_marginTop="@dimen/margintop"
android:clickable="true"
android:paddingRight="@dimen/layoutpaddingright"
android:text="Right"
android:textColor="#ffffff"
android:background="@drawable/save1"
android:textSize="@dimen/header_rightbtn"
/>
</LinearLayout>
For MainActivity or which activity you want to add title :
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
getSupportActionBar().setCustomView(R.layout.header_sherlock);
header_tvleft = (Button) findViewById(R.id.header_tvleft);
header_tvleft.setText("LeftTitleName");
header_tvcenter = (Button) findViewById(R.id.header_tvcenter);
header_tvcenter.setText("CenterTitleName");
header_tvright = (Button) findViewById(R.id.header_tvright);
header_tvright.setText("RightTitleName");
then you will the listener code for button like this..
// In this Button Listener code inside, we able to set the sliding menu coding....
header_tvleft.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// inside you will able to set your sliding menu whatever.......
}
});
Note : This are all possible only for creating the Custom Action bar.....
if you want any clarification more regarding this, I like to answer your query....