Two ways are there but as negative padding is not recommended so the 2nd way.
=> Using a separate text view
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:layout_height="wrap_content">
<Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/switch1" />
<TextView
android:layout_width="wrap_content"
android:text="This is a switch"
android:layout_height="wrap_content" />
</LinearLayout>
EDIT - There's no direct way but using Negative padding, A parent Layout or Any custom library.
See here and here.
Forget this and use this library.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…