I want to create a drawable file like the below screenshot.

My drawable xml file:
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/green_button"/>
<item android:left="@dimen/_11sdp"
android:gravity="center_vertical|left"
android:drawable="@drawable/radio_button_bg"/>
</layer-list>
//drawable/radio_button_bg
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item >
<shape android:shape="oval" >
<solid android:color="@color/darkgrey">
</solid>
<size android:width="@dimen/_15sdp"
android:height="@dimen/_15sdp"/>
</shape>
</item>
</selector>
//drawable/green_button
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item >
<shape android:shape="rectangle" >
<corners android:radius="6dip" />
<solid android:color="@color/selected_slot">
</solid>
<!--<stroke android:width="1dip" android:color="#5e7974" />-->
</shape>
</item>
</selector>
I created two separate files and I merged them by using layer_list. But the issue is it is not working in different mobiles, also the white circle inside the drawable is becomes big after setting height and width.
from Android layerlist is not working in different mobiles
No comments:
Post a Comment