安卓Api Demo学习 App/Activity/Custom Title
2011-10-19 15:05
501 查看
首先要告诉系统自定义的类型
核心函数requestWindowFeature。一般用来自定义标题,以及标题栏进度图形,或者让程序没有title
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.custom_title);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title_1); <--这里设置Title的布局
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>
final TextView leftText = (TextView) findViewById(R.id.left_text); 取得标题中的Textview组件
leftText.setText(leftTextEdit.getText()); 设置文字
效果如下
核心函数requestWindowFeature。一般用来自定义标题,以及标题栏进度图形,或者让程序没有title
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.custom_title);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title_1); <--这里设置Title的布局
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>
final TextView leftText = (TextView) findViewById(R.id.left_text); 取得标题中的Textview组件
leftText.setText(leftTextEdit.getText()); 设置文字
效果如下
相关文章推荐
- Api demo源码学习(3)--App/Activity/Custom Title --自定义标题栏
- 安卓Api Demo学习 App/Activity/Dialog
- Api demo源码学习(2)--App/Activity/Custom Dialog --自定义Activity样式
- [转]Api demo源码进修(3)--App/Activity/Custom Title --自定义题目栏
- 【起航计划 006】2015 起航计划 Android APIDemo的魔鬼步伐 05 App->Activity->Custom Title 自定义标题栏
- Android ApiDemo示例解读系列之五:App->Activity->Custom Title
- ApiDemo的学习总结,个人心得,App模块之Activity
- 安卓ApiDemos学习 app/Activity/QuickContactsDemo
- Api demo源码学习(4)--App/Activity/Dialog --Activity以Dialog形式呈现
- Api demo源码学习(14)--App/Activity/Translucent && Translucent Blur
- Api demo源码学习(6)--App/Activity/Hello World
- Api demo源码学习(9)--App/Activity/Receive Result --Activity间传递数据
- Api demo源码学习(7)--App/Activity/Persistent State
- 【起航计划 006】2015 起航计划 Android APIDemo的魔鬼步伐 05 App-&gt;Activity-&gt;Custom Title 自定义标题栏
- Api demo源码学习(11)--App/Activity/Reorder Activity
- 安卓ApiDemos学习 app/Activity/Forwarding
- 安卓ApiDemos学习 app/Activity/PersistentState
- Android ApiDemos详解之App/Activity/Custom Title(1)
- Api demo源码学习(17)--App/Device Admin
- Android ApiDemo学习(三)activity(2)