0x0001
0x0001

Reputation: 255

Combine multiple backgrounds on android XML?

Can I combine my own android drawable and ?android:selectableItemBackground...? I searched a lot but I can't find the right answer... For example lets say I have a simple button and I want this:

<Button
    android:id="@+id/bTest"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="?android:selectableItemBackground" | @drawable/myDrawable/>

Any ideas?

Upvotes: 6

Views: 6200

Answers (1)

Taichiro Suzuki
Taichiro Suzuki

Reputation: 147

How about using 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>

or using ImageButton

<ImageButton
    android:id="@+id/bTest"
    android:src="@drawable/myDrawable"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="?android:selectableItemBackground"/>

Upvotes: 3

Related Questions