Reputation: 8563
I have a custom @drawable
as a background for a button. I have a bitmap and a shape on top of it. The problem is that the corners of the bitmap are not clipping to the shape, like illustrated bellow.
My question is: Is there a way to clip the bitmaps to the bounds the shape? How?
EDIT: Here is the XML:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape>
<solid
android:color="#8F8F8F" />
<stroke
android:width="1dp"
android:color="#8f8f8f" />
<corners
android:radius="8dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
<item>
<layer-list>
<item>
<!-- <nine-patch android:src="@drawable/button"/>-->
<bitmap android:src="@drawable/background_image" />
</item>
<item>
<shape>
<solid android:color="@android:color/transparent" />
<stroke android:width="1dp" android:color="#8f8f8f" />
<corners android:radius="12dp" />
<padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
</shape>
</item>
</layer-list>
</item>
</selector>
Upvotes: 0
Views: 1623
Reputation: 24820
You will have to change alpha level at the corners or use Draw 9-patch tool to create the background
Upvotes: 1