如果我使用创建自定义标题栏的众多教程之一,它似乎会改变主题的其余部分。
如何更改标题栏而不更改主题的其余部分,例如菜单菜单和编辑文本框等
//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>