How to put space between switch button and its text in android?

Profile2ForStack picture Profile2ForStack · Dec 22, 2017 · Viewed 9.3k times · Source

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

Answer

Peridis picture Peridis · Mar 9, 2018

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