标签:
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main);
//自定义标题栏
mWindow = getWindow();
mWindow.setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.titlebar);
titlebar.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" > <TextView android:text="@string/app_name" android:textColor="#000" android:paddingRight="3.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:text="@string/battery_text" android:textColor="#000" android:paddingRight="3.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:id="@+id/battery_text" android:textColor="#00f" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </LinearLayout>
标签:
原文地址:http://www.cnblogs.com/DASOU/p/4261038.html