Reputation:
I have some buttons and I declared their background like this:
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:text=""
android:layout_weight="1"
android:background="@drawable/backgroundxml"
/>
and here is the backgroundxml:
<stroke
android:width="1dp"
android:color="#FFFFFF" />
<corners android:radius="3dp" />
<gradient
android:angle="270"
android:centerColor="#f1f1f2"
android:endColor="#d1d3d4"
android:startColor="#ffffff" />
</shape>
But now I have got a problem. I want to keep that Style But insted of Buttons with Text on them, I want to set a drawable on them. But when I change the Background from:
android:background="@drawable/backgroundxml"
to
android:background="@drawable/mybackbutton"
then I dont have the stroke and the start, center and endcolor in the background. So how can I set the Drawable but still keep the background?
Thanks
Upvotes: 1
Views: 157
Reputation: 12382
Try with ImageButton. Something like this:
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/your_drawable"
android:background="@drawable/your_background" />
Upvotes: 2