Java 按钮在预览时透明,但在模拟器上为实心

Java 按钮在预览时透明,但在模拟器上为实心,java,android,xml,Java,Android,Xml,我正在尝试将一些按钮设置为透明,以及部分透明。他们使用的是透明/纯色渐变 它们在预览中显示得很好,但在模拟器和我的手机上,它失去了所有的透明度 以下是我的XML代码: <Button android:id="@+id/barbarian" android:layout_width="match_parent" android:layout_height="wrap_c

我正在尝试将一些按钮设置为透明,以及部分透明。他们使用的是透明/纯色渐变

它们在预览中显示得很好,但在模拟器和我的手机上,它失去了所有的透明度

以下是我的XML代码:

<Button
                    android:id="@+id/barbarian"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@drawable/button_gradient"
                    android:text="@string/barbarian" />

xml渐变代码(如果需要):

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
    android:startColor="@android:color/transparent"
    android:endColor="#FF000000"
    android:angle="0" />
   </shape>


我感谢所有的帮助

也许你对其他设备/屏幕有不同的button_gradient.xml?对不起,我对android还没有那么丰富的经验。我不知道那是什么意思。我该怎么检查呢?你可以为不同的屏幕分辨率提供不同的文件(在不同的设备上)看看这个