如何将前景图像设置为ImageButton?

How to set foreground Image to ImageButton?

我是 Android 应用程序开发的新手。我想在 API 级别 19 中将前景图像设置为图像按钮。如何执行此操作?

对于示例代码,将其用于 1 个答案的布局:

<FrameLayout
    android:id="@+id/answer_section"
    android:layout_width="100dp"
    android:layout_height="100dp">

    <ImageView
        android:id="@+id/answer_background"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/house_img"/>

    <ImageView
        android:id="@+id/answer_check"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/check_img"/>
</FrameLayout>

您对 2 个图像使用 2 个不同的 ImageView,这样它们就可以单独工作,例如制作动画,show/hide 有条件...