Issue
I've made custom Switch which is working fine on all android versions except KitKat. Its not on KitKat 4.4.4 screen. How can I make it visible on KitKat ? Any help would be great !
xml code :
<Switch
android:id="@+id/checkbox_missed"
android:layout_marginTop="20dp"
android:textSize="16dp"
android:text="Enable Missed Calls "
android:gravity="left"
android:thumbTextPadding="25dp"
android:textOn=""
android:textOff=""
android:track="@drawable/rectangle_track"
android:thumb="@drawable/rectangle_thumb"
android:layout_marginLeft="25dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
rectangle_track.xml :
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true">
<shape android:shape="rectangle">
<corners android:radius="6dp"/>
<solid android:color="@color/colorGreyGreen"/>
</shape>
</item>
<item android:state_checked="false">
<shape android:shape="rectangle">
<corners android:radius="6dp"/>
<solid android:color="@color/colorSilver"/>
</shape>
</item>
</selector>
rectangle_thumb :
<shape android:shape="rectangle"
xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffff"/>
<corners android:radius="5dp"/>
<size android:height="24dp" android:width="24dp"/>
<stroke android:width="4dp" android:color="@android:color/transparent"/>
</shape>
Solution
I don't know the exact details but SwitchCompat seems working with KK 19.
<android.support.v7.widget.SwitchCompat
android:id="@+id/checkbox_missed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:text="Enable Missed Calls "
android:textOff=""
android:textOn=""
android:textSize="16dp"
android:thumbTextPadding="25dp"
app:track="@drawable/rectangle_track"
android:thumb="@drawable/rectangle_thumb"
tools:checked="true" />
Answered By - Rahul
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.