Подтвердить что ты не робот

Правильный выравнивание текста в android?

Есть ли что-то особенное, что мне нужно сделать, чтобы получить выравнивание текста в <TableLayout>?

Следующий простой пример, похоже, выравнивает текст по правому краю в центре экрана, почти как если бы layout_span не имел эффекта.

<TableLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        >
    <TableRow>
        <TextView
                android:text="Some text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="right"
                android:layout_span="2"
                />
    </TableRow>
    <TableRow>
        <Button
                android:text="Button 1"
                android:layout_weight="50"/>
        <Button
                android:text="Button 2"
                android:layout_weight="50"/>
    </TableRow>
</TableLayout>
4b9b3361

Ответ 1

Фиксированный.

Удалена часть из TextView:

android:layout_gravity="right"
android:layout_span="2"

Обновлен раздел в TextView:

android:gravity="right"
android:layout_weight="1.0"


 <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_height="fill_parent"
      android:layout_width="fill_parent" >

      <TableRow>
           <TextView
                 android:text="Some text"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:gravity="right"
                 android:layout_weight="1.0" />
      </TableRow>
      <TableRow>
            <Button
                 android:text="Button 1"
                 android:layout_weight="50"/>
            <Button
                 android:text="Button 2"
                 android:layout_weight="50"/>
       </TableRow>
 </TableLayout>