(we all know) There are three parts in android Switch Widget ... Text - Thumb - Track.<br /> My question is how can we completely remove this text part if we don't want to use any text because it's ruining the balance of the layout <br /><img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/vJ9Av.png" data-original="https://i.stack.imgur.com/vJ9Av.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />Answer1:
You simply have to not provide any text:
<Switch android:id="@+id/switch1" android:layout_width="wrap_content" android:layout_height="wrap_content" />Answer2:
Use negative margin for the switch as follows and see if it works:
<Switch android:id="@+id/switch1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="-10dp" />
I know some people consider it a bad practice to use negative margin but right it seems to be the easiest way.
You can set margin programmatically as well based on device type.