cutom title bar

old/UI Design 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:

'old > UI Design' 카테고리의 다른 글

Shape  (0) 2010.08.10
shape layout  (0) 2010.08.04
adb shell에서 특정 activity실행하기  (0) 2010.07.06
PowerManager에서 Screen ON/OFF 통지  (0) 2010.07.06
Resources - Menus, Searchable  (0) 2010.07.01
Posted by jazzlife
,