简体   繁体   English

操作栏/按钮背景填充

[英]Action bar / button background fill

On some devices (such as older Samsung devices, the "Scroll Extreme" tablet this screenshot was taken on), the action bar and some buttons do not appear with the correct background or only partially filled. 在某些设备上(例如较旧的三星设备,此屏幕快照采用的是“ Scroll Extreme”平板电脑),操作栏和某些按钮的背景不正确或仅部分填充。 In the screenshot below, you can faintly see a button with white text which is missing a background. 在下面的屏幕截图中,您可以模糊地看到带有白色文本的按钮,但缺少背景。

在此处输入图片说明

The app only targets API level 14+ and is therefore not using the support lib or ActionBarSherlock. 该应用程序仅针对API级别14+,因此未使用支持库或ActionBarSherlock。 The style for the action bar is as follows: 操作栏的样式如下:

<style name="ActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
    <item name="android:background">@color/accent</item>
    <item name="android:titleTextStyle">@style/ActionBarTitleText</item>
    <item name="android:subtitleTextStyle">@style/ActionBarSubTitleText</item>
</style>
<style name="ActionBarTitleText" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
    <item name="android:textColor">@android:color/white</item>
</style>
<style name="ActionBarSubTitleText" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Subtitle">
    <item name="android:textColor">@android:color/white</item>
</style>

PS. PS。 the colours seen in the screenshot have not been correctly captured by the screenshot app, but the idea is there! 屏幕快照应用程序未正确捕获屏幕快照中显示的颜色,但是想法就在那里!

I believe this can be solved by changing the below to use a drawable as opposed to a color. 我相信可以通过更改以下内容以使用可绘制对象而不是颜色来解决。

 <item name="android:background">@color/accent</item>

Example drawable: 可绘制示例:

<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="@color/accent" />
</shape>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM