How to change height and width of Switch in Android

android, switch-statement

Solution

add this `android:switchMinWidth="56dp"` and try

<Switch
         android:id="@+id/plug_switch"
         android:layout_width="120dip"
         android:layout_height="10dp"
         android:maxHeight="10dp"
         android:thumbTextPadding="25dp"
         android:switchMinWidth="56dp"
         android:layout_below="@id/plug_graph_layout"
         android:layout_centerHorizontal="true"
         android:minWidth="100dp"

Problem

- I woudld like to fit the switch in 120dp width and 30dp height. - Also I want to no text in the thumb but would like to have the thumb cover half of the total width so i want it to be 60dp. - Also, I want the height of the thumb to be little less than the height of the switch of the background could be seen from 3 sides. I have no idea how to do #3 and for #1 and #2, I tried the following xml, but it is not working: ``` <Switch android:id="@+id/plug_switch" android:layout_width="120dip" android:layout_height="10dp" android:maxHeight="10dp" android:layout_below="@id/plug_graph_layout" android:layout_centerHorizontal="true" android:minWidth="100dp" android:thumb="@drawable/plugs_button" android:track="@drawable/btntoggle_selector" android:textOn="" android:textOff="" android:width="120dip" /> ``` could someone please help me with #1, #2 and #3. Thanks

Original source

Related problems