LOGO OA教程 ERP教程 模切知識交流 PMS教程 CRM教程 開發(fā)文檔 其他文檔  
 
網(wǎng)站管理員

Andorid 自定義標題欄

admin
2013年2月25日 14:39 本文熱度 4719

效果如圖:




先在strings.xml 中定義主題




[html]


  1.    <style name="customTitlebg" >  

  2.     <item name="android:background">@drawable/title_bg</item>  

  3. </style>  

  4.      

  5. <style name="titlebar" parent="android:Theme">  

  6.     <item name="android:windowTitleSize">40dp</item>   

  7.     <item name="android:windowTitleBackgroundStyle">@style/customTitlebg</item>   

  8. </style>  

在AndroidManifest.xml,application標簽中改為使用我們自定義的主題






[html]


  1. <application  

  2.         android:icon="@drawable/ic_launcher"  

  3.         android:label="@string/app_name"  

  4.         android:theme="@style/titlebar" >  

  5.         <activity  

  6.             android:name=".MainActivity"  

  7. ...  

下面是自定義標題欄的實現(xiàn) title_bar.xml






[html]


  1. <?xml version="1.0" encoding="utf-8"?>   

  2. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"   

  3.     android:orientation="horizontal" android:layout_width="fill_parent"   

  4.     android:layout_height="fill_parent">  

  5.     <ImageView android:layout_width="wrap_content"   

  6.         android:layout_centerVertical="true"  

  7.         android:layout_height="wrap_content"   

  8.         android:src="@drawable/title_home_normal" />  

  9.       

  10.     <TextView android:layout_width="wrap_content"   

  11.         android:layout_centerInParent="true"   

  12.         android:layout_height="wrap_content"   

  13.         android:textColor="#000000"  

  14.         android:text="自定義標題欄" />  

  15.   

  16.     <ImageView  

  17.         android:layout_width="wrap_content"  

  18.         android:layout_height="wrap_content"  

  19.         android:layout_alignParentRight="true"  

  20.         android:layout_centerVertical="true"  

  21.         android:src="@drawable/title_new_normal" />  

  22.   

  23. </RelativeLayout>  

最后修改Activity




[java]


  1. public void onCreate(Bundle savedInstanceState) {  

  2.     super.onCreate(savedInstanceState);  

  3.     requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); //聲明使用自定義標題    

  4.     setContentView(R.layout.tabhost);  

  5.     getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title_bar);//自定義布局賦值    

  6. }  

該文章在 2013/2/25 14:39:12 編輯過
關(guān)鍵字查詢
相關(guān)文章
正在查詢...
點晴ERP是一款針對中小制造業(yè)的專業(yè)生產(chǎn)管理軟件系統(tǒng),系統(tǒng)成熟度和易用性得到了國內(nèi)大量中小企業(yè)的青睞。
點晴PMS碼頭管理系統(tǒng)主要針對港口碼頭集裝箱與散貨日常運作、調(diào)度、堆場、車隊、財務費用、相關(guān)報表等業(yè)務管理,結(jié)合碼頭的業(yè)務特點,圍繞調(diào)度、堆場作業(yè)而開發(fā)的。集技術(shù)的先進性、管理的有效性于一體,是物流碼頭及其他港口類企業(yè)的高效ERP管理信息系統(tǒng)。
點晴WMS倉儲管理系統(tǒng)提供了貨物產(chǎn)品管理,銷售管理,采購管理,倉儲管理,倉庫管理,保質(zhì)期管理,貨位管理,庫位管理,生產(chǎn)管理,WMS管理系統(tǒng),標簽打印,條形碼,二維碼管理,批號管理軟件。
點晴免費OA是一款軟件和通用服務都免費,不限功能、不限時間、不限用戶的免費OA協(xié)同辦公管理系統(tǒng)。
Copyright 2010-2025 ClickSun All Rights Reserved

黄频国产免费高清视频,久久不卡精品中文字幕一区,激情五月天AV电影在线观看,欧美国产韩国日本一区二区
亚洲乱码AV中文字幕 | 亚洲Av一在线观看 | 欧美亚洲日韩不卡在线在线观看 | 五月天中文字幕综合网 | 尹人香蕉久久99天天拍国产 | 亚洲日韩国产综合一区二区三区 |