首页 > 其他 > 详细

如何定制Activity的标题栏

时间:2015-01-29 23:44:03      阅读:322      评论:0      收藏:0      [点我收藏+]

 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>

 

如何定制Activity的标题栏

原文:http://www.cnblogs.com/DASOU/p/4261038.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!