转载自:
http://blog.csdn.net/yuxiaohui78/article/details/8222993
新建一个styles.xml
1 | <? xmlversion = "1.0" encoding = "utf-8" ?> |
3 | < style name = "titlebarstyle" parent = "Android:Theme" > |
4 | < item name = "Android:windowTitleSize" >38dip</ item > |
上面<item name="Android:windowTitleSize">39dip</item>这一句,就是用来设定Titlebar的高度的。
我们需要修改AndroidManifest.xml中,相应Activity的属性。代码如下:
01 | <? xmlversion = "1.0" encoding = "utf-8" ?> |
05 | package = "com.pat.customizetitlebar" |
07 | Android:versionCode = "1" |
09 | Android:versionName = "1.0" > |
11 | < application Android:icon = "@drawable/icon" android:label = "@string/app_name" > |
13 | < activity Android:name = ".CustomizeTitlebar" |
15 | Android:label = "@string/app_name" |
17 | Android:theme = "@style/titlebarstyle" > |
21 | < action Android:name = "android.intent.action.MAIN" /> |
23 | < category Android:name = "android.intent.category.LAUNCHER" /> |
33 | < uses-sdk Android:minSdkVersion = "8" /> |