old/UI Design
cutom title bar
jazzlife
2010. 8. 4. 15:57
enter code heremy_title.xml
<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" />
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.my_title);
((TextView)findViewById(R.id.title)).setText("gradient shadow");
findViewById(R.id.back).setOnClickListener(new OnClickListener() {
public void onClick(View v) {
((TextView)findViewById(R.id.title)).setText("loce");
}
});
because custom title default is fixed you should write yourself theme: