So I'm trying to customize a switch button a little bit. The way I want it to look is the following:
What I tried implementing so far is:
<Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/switchButton"
android:layout_marginBottom="40dp"
android:textOn=""
android:thumb="@drawable/shape_track"
android:track="@drawable/shape_thumb"
android:layout_marginRight="10dp"
android:textOff=" "
android:layout_alignParentBottom="true"
android:layout_toRightOf="@+id/dateOutput"/>
Shape_thumb:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<size android:height="30dp"/>
<corners
android:radius="3dp"/>
<stroke
android:width="2dp"
android:color="@color/wampRed"/>
</shape>
Shape_track :
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/wampRed"/>
<corners android:radius="2dp"/>
<stroke android:width="1.5dp" android:color="@color/wampWhite"/>
<padding android:bottom="3dp" android:left="3dp" android:right="3dp" android:top="3dp"/>
</shape>
Problem is I'm not really sure how to create the border for the inside part of the switch. What's more, I found it hard playing with the height/width of the switch button overall.
0 comments:
Post a Comment