I want to create a custom View based on ImageView
to make a widget as below where the drawable source is the camera and the background is the rectangle with the tick sign:
The problems are:
- I can not create the border with the tick sign on the right: the tick is stretched fullscreen instead of staying at the bottom right.
- The tick sign is sometime behind the image if I set it with
android:background
.
Here are my xml
files:
The current border xml drawable
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@android:color/transparent"/>
<stroke
android:width="2dip"
android:color="@color/bg_black"/>
<padding
android:left="3dp"
android:right="3dp"
android:top="3dp"
android:bottom="3dp"
/>
</shape>
</item>
<item >
<layer-list >
<item>
<shape
android:shape="rectangle">
<stroke
android:width="2dp"
android:color="@color/border_yellow"/>
<size
android:width="37dp"
android:height="37dp"/>
<padding
android:bottom="3dp"
android:left="3dp"
android:right="3dp"
android:top="3dp"/>
</shape>
</item>
<item android:drawable="@drawable/ic_tick"/>
</layer-list>
</item>
</layer-list>
The Image Button xml layout
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/product1"
android:background="@drawable/toggle_rectangle_check"/>
Thanks for your time.