Reputation: 513
I had a scenario where I need to have spaces for android:text attribute value.
android:text="Input type" ---> I need output with 5 spaces between "Input" and "type" Strings
How can I achieve the above result.
Thanks in Advance
Upvotes: 0
Views: 2741
Reputation: 2335
Add this  
with your strings in xml file
<string name="stringsample">Sample: </string>
Upvotes: 1
Reputation: 71
It's better to use string ressources.
Put all your string value in a file on res/values/strings.xml
.
If you want to add space you can do it by surround your text by double quotes.
You can see an example in the documentation : http://developer.android.com/guide/topics/resources/string-resource.html#FormattingAndStyling
Upvotes: 1
Reputation: 3408
<TextView
android:id="@+id/xxx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/empty_spaces" />
in strings.
<string name="empty_spaces">Input\t\t type</string>
Upvotes: 2
Reputation: 85
You can replace spaces by \u0020
<TextView android:text="Input\u0020\u0020\u0020\u0020\u0020types" />
Upvotes: 1