Create a new styles.xml
<?xmlversion="1.0" encoding="utf-8"?> < resources> <style name="titlebarstyle"parent= " Android:theme"> <item name="android:windowtitlesize" >38dip</item> </style> </resources>
Above <item name="android:windowtitlesize" >39dip</item> This sentence, is used to set the height of titlebar.
We need to modify the properties of the corresponding activity in Androidmanifest.xml. The code is as follows:
<?xmlversion="1.0"encoding="Utf-8"?> <manifestxmlns:android="http://schemas.android.com/apk/res/android" Package="Com.pat.customizetitlebar"Android:versioncode="1"Android:versionname="1.0"> <applicationandroid:icon="@drawable/icon"Android:label="@string/app_name"> <activity android:name=". Customizetitlebar"Android:label="@string/app_name"Android:theme="@style/titlebarstyle"> <intent-filter> <action android:name="Android.intent.action.MAIN"/> <categoryandroid:name="Android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> <uses-sdk A ndroid:minsdkversion="8"/> </manifest>
How Android Sets the height of the title bar