我在我的应用程序中设置了操作栏的样式,但在Android KitKat(右侧设备)和Android Lollipop(左侧设备)上看起来有所不同,如图所示:
我想添加一些图标填充(左,右),使其与Lollipop相同。有关如何修改以下XML文件的任何想法吗?
资源/值/ styles.xml
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MyCustomTheme" parent="android:Theme.Holo.Light">
<item name="android:colorActivatedHighlight">@android:color/transparent</item>
<item name="android:actionMenuTextColor">@android:color/white</item>
</style>
</resources>
资源/值-V21 / styles.xml
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MyCustomTheme" parent="android:Theme.Material.Light">
<item name="android:colorActivatedHighlight">@android:color/transparent</item>
<item name="android:actionMenuTextColor">@android:color/white</item>
<item name="android:textColorPrimary">@android:color/white</item>
</style>
</resources>
答案 0 :(得分:1)
的资源/值/ styles.xml 强>
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MyCustomTheme" parent="android:Theme.Holo.Light">
<item name="android:colorActivatedHighlight">@android:color/transparent</item>
<item name="android:actionMenuTextColor">@android:color/white</item>
<item name="android:actionBarStyle">@style/MyCustomActionBar</item>
</style>
<style name="MyCustomActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
<item name="android:logo">@drawable/actionBarIcon</item>
</style>
</resources>
<强>资源/抽拉/ actionBarIcon.xml 强>
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/ic_launcher"
android:right="10dp" android:left="10dp"/>
</layer-list>