Android按钮:显示黑色方块而不是img?

1 android button

我有一个相当小但很奇怪的问题,我似乎无法修复.我正在尝试为我的按钮显示图像,它显示为黑色方块.我在此之前制作的按钮显示并且工作正常,但是此按钮(以及之后制作的其余按钮)显示为黑色方块.现在,如果我将其更改为ImageView而不是按钮,则显示正常.

以前有没有人遇到过这个问题?如果是这样,你是如何解决的?我仍然是编程的新手,我正在自学,所以我真的没有任何帮助,我一直在尝试修复它一段时间.:(

这是按钮/图像的xml.

<RelativeLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <Button
            android:id="@+id/pause"
            android:src="@drawable/pause"

            android:layout_width="29px"
            android:layout_height="29px"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:layout_marginTop="15dp"
            android:layout_marginRight="10dp">
        </Button>

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

如果您有任何其他问题,请询问,并感谢您查看我的问题!:)

Sam*_*zor 8

使用ImageButton代替Buttonandroid:src="@drawable/pause"改为 android:background="@drawable/pause"