Android 使用AppBaseTheme父级设置自定义主题
我在我的style.xml:Android 使用AppBaseTheme父级设置自定义主题,android,android-manifest,android-theme,titlebar,Android,Android Manifest,Android Theme,Titlebar,我在我的style.xml: <style name="customTheme" parent="AppBaseTheme"> <item name="android:windowTitleSize">40dip</item> </style> 问题是,当我尝试设置此自定义标题时,如下所示: requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); setContentView(R.l
<style name="customTheme" parent="AppBaseTheme">
<item name="android:windowTitleSize">40dip</item>
</style>
问题是,当我尝试设置此自定义标题时,如下所示:
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.activity_home);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title_bar);
我在第二行得到一个错误,它说:
不能将自定义标题与其他标题功能组合
如果您打电话给我,我如何只将标题更改为我的自定义\u title\u bar
布局,就可以保留原始主题
setFeatureInt(Window.FEATURE_CUSTOM_TITLE, ...)
如果已经设置了ActionBar(例如Holo主题),则可能会导致此问题
试试这个:
<item name="android:windowActionBar">false</item>
false
在自定义主题中。以自定义主题的样式自定义标题栏
<item name="android:windowActionBar">false</item>