Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I give space in between text in textview?

I need to make something like this according to Android screen bound,

 S             M             T              W               T              F               S

I am doing like this:

    <TextView
    android:id="@+id/textView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="45dp"
    android:text="S       M       T        W        T        F       S" />

This is not working properly, not according to device screen bound. I need something like this:

<TextView
    android:id="@+id/textView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="45dp"
    android:text="S""10dp""M""10dp""T""10dp""W""10dp""T""10dp""F""10dp""S""10dp" />
like image 684
Steve Avatar asked Jul 03 '14 11:07

Steve


Video Answer


2 Answers

Use the letterSpacing attribute for spacing between letters:

android:id="@+id/txt_work"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:typeface="serif"
android:layout_below="@+id/txt_wecm"
android:layout_marginLeft="20dp"
android:textSize="32dp"
android:letterSpacing="0.1"
android:textColor="#fff"
android:text="World" 
like image 196
Gaganpreet kaur Avatar answered Oct 02 '22 20:10

Gaganpreet kaur


We can use it.

<TextView android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="A&#160;B&#160;&#160;&#160;&#160;&#160;C"/>
like image 38
App Kart Avatar answered Oct 02 '22 18:10

App Kart