在android XML上组合多个背景?

Chu*_*and 6 xml android drawable

我可以将我自己的 android drawable 和 ?android:selectableItemBackground... 结合起来吗?我搜索了很多,但找不到正确的答案......例如,假设我有一个简单的按钮,我想要这个:

<Button
    android:id="@+id/bTest"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="?android:selectableItemBackground" | @drawable/myDrawable/>
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

小智 3

使用FrameLayout怎么样

<FrameLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/myDrawable">
    <Button
        android:id="@+id/bTest"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="?android:selectableItemBackground"/>
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)

或使用图像按钮

<ImageButton
    android:id="@+id/bTest"
    android:src="@drawable/myDrawable"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="?android:selectableItemBackground"/>
Run Code Online (Sandbox Code Playgroud)