我有RelativeLayout
一个背景设置为android:background="@drawable/background"
.
在我的 RelativeLayout` 中,我有一个标准按钮,但是当我在运行 3.1 或更高版本的设备中运行应用程序时,按钮显示为透明的。
我试过设置android:alpha
为 1 没有运气。
我知道我可以使用选择器和形状制作自定义背景,但必须有另一种方式。
还有其他人有这个问题吗?
我有RelativeLayout
一个背景设置为android:background="@drawable/background"
.
在我的 RelativeLayout` 中,我有一个标准按钮,但是当我在运行 3.1 或更高版本的设备中运行应用程序时,按钮显示为透明的。
我试过设置android:alpha
为 1 没有运气。
我知道我可以使用选择器和形状制作自定义背景,但必须有另一种方式。
还有其他人有这个问题吗?
您需要将类似的内容添加到您的 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>
确保您也在清单中正确设置主题
<application
android:allowBackup="true"
android:icon="@drawable/app_icon"
android:label="@string/app_name"
android:theme="@style/Theme.ApplicationStyle" >