requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); setContentView(R.layout.my);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
R.layout.my_title);
my_title.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/header"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content" android:layout_width="fill_parent"
android:background="#d4e9a9">
<ImageView android:src="@drawable/jetpack"
android:layout_width="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:id="@+id/back"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" />
<TextView android:id="@+id/title"
android:layout_width="wrap_content"
android:gravity="center_vertical"
android:textSize="20px"
android:textColor="#ffffff"
android:layout_alignParentRight="true"
android:text="New Title"
android:background="#a5c639"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:padding="9dip"
android:layout_margin="5dip" />
</RelativeLayout>
jetpack.xml:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false"
android:drawable="@drawable/jetpack_normal" />
<item android:state_pressed="true"
android:drawable="@drawable/jetpack_pressed" />
</selector>