32

I have the following element:

<Switch
    android:text="Data about client?"
    android:id="@+id/connected" />

But on designer the switch button and its text "Data about client?" are very glued together. I tried putting space between ? and " like that :

android:text="Data about client?    "

But I don't like that type of solution very much

Profile2ForStack
  • 473
  • 2
  • 8
  • 16

4 Answers4

114

I had the same issue, but for me the accepted answer of Sravan Sriram did not solve the problem.

What worked for me was the tag

android:switchPadding = "10dp" 

Minimum space between the switch and caption text. docs

Periklis Vai
  • 1,395
  • 2
  • 11
  • 19
15

Sure, kindly use this

android:switchPadding="5dp"
adiga
  • 34,372
  • 9
  • 61
  • 83
Ashwin Balani
  • 745
  • 7
  • 19
6

If you are using androidx.appcompat.widget.SwitchCompat then use app:switchPadding="8dp". This is work for me

Dhaval Baldha
  • 241
  • 3
  • 5
-8

In This pic

Use tag "android:thumbTextPadding"

Community
  • 1
  • 1