`
ouyangfeng521
  • 浏览: 243155 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

android 自定义title

阅读更多

先写个布局文件

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/screen"
    android:layout_width="match_parent" android:layout_height="match_parent"
    android:orientation="vertical">
    <TextView android:id="@+id/left_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:text="@string/custom_title_left" />
    <TextView android:id="@+id/right_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:text="@string/custom_title_right" />
</RelativeLayout>

 代码

  requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
        setContentView(R.layout.custom_title);
        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title_1);
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics