我有一个自定义主题,针对API级别“7-13”和“14及以上”有不同的style.xml
<style name="CustomTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<!-- Setting values in the default namespace affects API levels 7-13 -->
<item name="actionBarStyle">@style/CustomTheme</item>
</style>
<style name="CustomTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<!-- Setting values in the default namespace affects API levels 7-13 -->
<item name="background">@color/medium_turquoise</item>
</style>
<style name="CustomTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<item name="actionBarSize">200dp</item>
</style>
<style name="CustomTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<item name="homeAsUpIndicator">@drawable/back_button_actionbar</item>
我把我的应用程序主题设置为"@style/CustomTheme",并在我的活动中设置了以下内容。
addView = getLayoutInflater().inflate(R.layout.actionbar, null);
getSupportActionBar().setCustomView(addView);
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
整个屏幕都被操作栏占据了,我试图改变高度,但没有用。我猜我在样式上做错了什么。
谢谢