0

テーブル レイアウト (以下のコード) がありますが、セルの幅に少し問題があります。下の図は問題を示しています。画面の右側に白い境界線があるはずです。また、「Auditorium」というテキストを新しい行に折り返さないようにしたいです (代わりに「13th -」を新しい行に配置することをお勧めします。\n をそこに入れたくありません。大きな画面/横向きビューでは、その時点で新しい行に移動します)。

これら2つの問題を解決するにはどうすればよいですか?

幅の問題

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#013567" >

<TableLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:shrinkColumns="*"
    android:stretchColumns="*" >

    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/textlines"
            android:gravity="center"
            android:text="@string/meeting_5"
            android:textColor="#fff" >
        </TextView>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/textlines"
            android:gravity="center"
            android:text="@string/meeting_5_date"
            android:textColor="#fff" >
        </TextView>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/textlines"
            android:gravity="center"
            android:text="@string/meeting_5_location"
            android:textColor="#fff" >
        </TextView>
    </TableRow>

    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/textlines"
            android:gravity="center"
            android:text="@string/AGM"
            android:textColor="#fff" >
        </TextView>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/textlines"
            android:gravity="center"
            android:text="@string/AGM_date"
            android:textColor="#fff" >
        </TextView>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/textlines"
            android:gravity="center"
            android:text="@string/AGM_location"
            android:textColor="#fff" >
        </TextView>
    </TableRow>
</TableLayout>

4

1 に答える 1

0

xmlファイルでこのコードを使用するだけです

  <TableLayout
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:shrinkColumns="*"
     android:stretchColumns="*" 
     android:layout_margin="2dp"
     android:layout_gravity="center_horizontal">

<TableRow
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/textlines"
        android:gravity="center"
        android:text="meeting_5"
        android:textColor="#fff" >
    </TextView>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/textlines"
        android:gravity="center"
        android:text="meeting_5_date"
        android:textColor="#fff" >
    </TextView>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/textlines"
        android:gravity="center"
        android:text="meeting_5_location"
        android:textColor="#fff" >
    </TextView>
</TableRow>

<TableRow
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/textlines"
        android:gravity="center"
        android:text="AGM"
        android:textColor="#fff" >
    </TextView>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/textlines"
        android:gravity="center"
        android:text="AGM_date"
        android:textColor="#fff" >
    </TextView>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/textlines"
        android:gravity="center"
        android:text="AGM_location"
        android:textColor="#fff" >
    </TextView>
</TableRow>
</TableLayout>
</ScrollView>
于 2012-10-05T03:36:22.547 に答える