Android的正常按钮变成透明 [英] Android normal button turns transparent
本文介绍了Android的正常按钮变成透明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 RelativeLayout的
与设置背景的android:背景=@绘制/背景
在我RelativeLayout`我有一个标准的按钮,但是当我运行运行3.1或更高版本的按钮设备的应用程序都显示透明。
In my RelativeLayout` I have a standard button but when I run the app in devices running 3.1 or higher the button are displayed transparent.
我曾尝试 Android的设置:阿尔法
1,没有运气
I have tried setting android:alpha
to 1 with no luck.
我知道我可以在选择和形状的自定义背景,但必须有另一种方式。
I know I can make a custom background with selector and shapes but there has to be another way.
任何人都有这个问题?
推荐答案
您会想这样的事情添加到您的style.xml
You'll want to add something like this to your style.xml
应用主题
<style name="ApplicationStyle" parent="android:Theme">
<item name="android:buttonStyle">@style/MyButtons</item>
</style>
按钮样式
<style name="MyButtons" parent="@android:style/Widget.Button">
<item name="android:textSize">16sp</item>
<item name="android:background">#000000</item>
</style>
请确保您还正确设置你的主题在清单
Make sure you're setting your theme correctly in the manifest also
<application
android:allowBackup="true"
android:icon="@drawable/app_icon"
android:label="@string/app_name"
android:theme="@style/Theme.ApplicationStyle" >
这篇关于Android的正常按钮变成透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文