我可以结合我自己的 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/>
有什么想法吗?
最佳答案
如何使用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>
或者使用ImageButton
<ImageButton
android:id="@+id/bTest"
android:src="@drawable/myDrawable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:selectableItemBackground"/>
关于android - 在 android XML 上结合多个背景?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38635056/