0
如果我使用許多教程中創建自定義標題欄之一,它似乎改變了主題的其餘部分。使用自定義標題欄,同時有正常的主題
我如何更改標題欄用了它更改主題的其餘部分如菜單菜單和EditText上盒等
//mainactivity.java
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.activity_main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.customtitlebar);
//manifest.
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<activity
android:name="com.MediocreFireworks.cheapchug.MainActivity"
android:label="@string/app_name"
android:theme="@style/CustomTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
//style.xml
<style name="CustomWindowTitleBackground">
<item name="android:background">#323331</item>
</style>
<style name="CustomTheme" parent="android:Theme.Light">
<item name="android:windowTitleSize">35dip</item>
<item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>
你是否正確地擺脫它並製作你自己的? –
你的意思只是刪除標題欄,然後添加到屏幕頂部的佈局作爲標題欄? – Thomas
是的。這也可以讓你添加按鈕。我只是不知道這是你想要的。 –