0

PROBLEM

I want to make my TextView look like below pic, is it possible ?

please advice, Thank !

this

NOTE

when I use spannable and set ° to become small, its height is place at the middle of 20.

However, I can't make C and ° in the same vertical.

Jongz Puangput
  • 5,527
  • 10
  • 58
  • 96
  • http://stackoverflow.com/questions/23990381/how-to-create-vertically-aligned-superscript-and-subscript-in-textview – Aniruddha Jul 21 '14 at 01:34

1 Answers1

1

Try this:

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="70dp" >

    <TextView
        android:id="@+id/deg_number"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="20"
        android:textSize="65sp" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="70dp"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/deg_symbol"
            android:layout_width="30dp"
            android:layout_height="35dp"
            android:gravity="top|center_horizontal"
            android:text="°"
            android:textSize="70sp"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/deg_units"
            android:layout_width="30dp"
            android:layout_height="35dp"
            android:gravity="bottom|center_horizontal"
            android:text="C"
            android:textSize="20sp" />

    </LinearLayout>

</LinearLayout>
arleitiss
  • 1,304
  • 1
  • 14
  • 38