Android如何设置标题栏的高度
转载自:
http://blog.csdn.net/yuxiaohui78/article/details/8222993
新建一个styles.xml
1 |
<? xmlversion = "1.0" encoding = "utf-8" ?> |
2 |
< resources > |
3 |
< style name = "titlebarstyle" parent = "Android:Theme" > |
4 |
< item name = "Android:windowTitleSize" >38dip</ item > |
5 |
</ style > |
6 |
</ resources > |
上面<item name="Android:windowTitleSize">39dip</item>这一句,就是用来设定Titlebar的高度的。
我们需要修改AndroidManifest.xml中,相应Activity的属性。代码如下:
01 |
<? xmlversion = "1.0" encoding = "utf-8" ?> |
02 |
03 |
< manifestxmlns:Android = "http://schemas.android.com/apk/res/android" |
04 |
05 |
package = "com.pat.customizetitlebar" |
06 |
07 |
Android:versionCode = "1" |
08 |
09 |
Android:versionName = "1.0" > |
10 |
11 |
< application Android:icon = "@drawable/icon" android:label = "@string/app_name" > |
12 |
13 |
< activity Android:name = ".CustomizeTitlebar" |
14 |
15 |
Android:label = "@string/app_name" |
16 |
17 |
Android:theme = "@style/titlebarstyle" > |
18 |
19 |
< intent-filter > |
20 |
21 |
< action Android:name = "android.intent.action.MAIN" /> |
22 |
23 |
< category Android:name = "android.intent.category.LAUNCHER" /> |
24 |
25 |
</ intent-filter > |
26 |
27 |
</ activity > |
28 |
29 |
|
30 |
31 |
</ application > |
32 |
33 |
< uses-sdk Android:minSdkVersion = "8" /> |
34 |
35 |
|
36 |
37 |
</ manifest > |