自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Android ApiDemo示例解讀5:Activity->Custom Title

移動(dòng)開發(fā) Android
Android允許Activity自定義標(biāo)題欄,使用自定義Layout重新設(shè)置標(biāo)題欄,App->Activity->Custom Title 重新將Activity標(biāo)題欄定義為左右兩個(gè)文本框。

Android UI缺省的標(biāo)題欄由android:label 定義,顯示在屏幕左上角,Android允許Activity自定義標(biāo)題欄,使用自定義Layout重新設(shè)置標(biāo)題欄,比如實(shí)現(xiàn)Windows Mobile 風(fēng)格的標(biāo)題欄。

App->Activity->Custom Title 重新將Activity標(biāo)題欄定義為左右兩個(gè)文本框,其Layout定義R.layout.custom_title_1如下:

(下面的xml中包含了一左一右兩個(gè)文本框。

與每個(gè)Activity對(duì)應(yīng)的除了使用由setContentView設(shè)置的Content View之外,還有一個(gè)Windows類對(duì)象,Windows 類對(duì)象用于控制標(biāo)題欄,可以允許自定義標(biāo)題欄或是不顯示標(biāo)題欄。)

  1. <RelativeLayout   
  2.  xmlns:android=”http://schemas.android.com/apk/res/android”   
  3.  android:id=”@+id/screen”   
  4.  android:layout_width=”match_parent”   
  5.  android:layout_height=”match_parent”   
  6.  android:orientation=”vertical”>   
  7.  <TextView android:id=”@+id/left_text”   
  8.  android:layout_width=”wrap_content”   
  9.  android:layout_height=”wrap_content”   
  10.  android:layout_alignParentLeft=”true”   
  11.  android:text=”@string/custom_title_left” />   
  12.  <TextView android:id=”@+id/right_text”   
  13.  android:layout_width=”wrap_content”   
  14.  android:layout_height=”wrap_content”   
  15.  android:layout_alignParentRight=”true”   
  16.  android:text=”@string/custom_title_right” />   
  17.  </RelativeLayout>   

Windows 定義了一些Feature,允許開發(fā)人員做些定制:自定義標(biāo)題欄對(duì)應(yīng)的Feature ID為Window.FEATURE_CUSTOM_TITLE。

  1. requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);   
  2. setContentView(R.layout.custom_title);   
  3. getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title_1);   

Android ApiDemo示例解讀系列之五:App->Activity->Custom Title

 

責(zé)任編輯:閆佳明 來源: jizhuomi
相關(guān)推薦

2013-12-19 14:13:16

Android ApiAndroid開發(fā)Android SDK

2013-12-19 14:32:31

Android ApiAndroid開發(fā)Android SDK

2013-12-19 14:34:52

Android ApiAndroid開發(fā)Android SDK

2013-12-19 14:36:43

Android ApiAndroid開發(fā)Android SDK

2013-12-19 14:28:04

Android ApiAndroid開發(fā)Android SDK

2013-12-19 14:00:39

Android ApiAndroid開發(fā)Android SDK

2013-12-19 13:40:44

Android ApiAndroid開發(fā)Android SDK

2013-12-19 13:51:12

Android ApiAndroid開發(fā)Android SDK

2013-12-19 16:26:29

Android ApiAndroid開發(fā)Android SDK

2010-02-02 14:22:50

Python示例

2010-02-01 11:22:09

C++虛函數(shù)

2014-05-27 14:33:37

AndroidActivitysingleTask

2010-03-02 14:41:00

WCF行為控制

2010-03-05 10:47:05

Python futu

2010-02-04 16:07:39

C++回調(diào)函數(shù)

2013-01-08 13:33:07

Android開發(fā)Activity入門指南

2010-01-04 17:03:27

Silverlight

2015-10-20 15:54:16

android源碼滑動(dòng)關(guān)閉

2012-02-17 17:07:30

Android安全Activity劫持

2010-01-08 10:48:05

VB.NET多線程
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)