我在使用TableLayout時遇到問題。我會在screeshots的幫助下解釋。android tablelayout,當輸入一個長文本文本時,列將其他列向右推
我創建了前兩行,每行都包含兩列。
然後,添加第三排只包含一列,當我添加一個冗長的文字到列,它推動前兩行的第2列到右邊。
有人請幫助我如何解決它。問候
這裏的代碼
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.cinch.gogch.activities.EmergencyProfileCardActivity"
android:orientation="vertical">
<TextView android:text="Emergency Profile Card"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/home_container_shape"
android:paddingLeft="8dp">
<TableRow
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:gravity="center_horizontal"
android:paddingTop="8dp">
<TextView
android:id="@+id/emailTextView"
android:text="[email protected]"
android:layout_weight="5"
android:textColor="#000000"
/>
<LinearLayout android:layout_weight="3">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/dobLabelTextView"
android:text="DOB: "
android:textColor="#000000"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/dobTextView"
android:text="29/06/1991"
android:textColor="#000000"
/>
</LinearLayout>
</TableRow>
<TableRow
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:gravity="center_horizontal"
android:paddingTop="2dp">
<LinearLayout android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_weight="5">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/genTextView"
android:text="Gender: "
android:textColor="#000000"
/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/genderTextView"
android:text="Male"
android:textColor="#000000"
/>
</LinearLayout>
<LinearLayout android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_weight="3">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/socialTextView"
android:text="SSN: "
android:textColor="#000000"
/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/ssnTextView"
android:text="123-42-1412"
android:textColor="#000000"
/>
</LinearLayout>
</TableRow>
<TableRow
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:paddingTop="2dp">
<TextView
android:layout_width="match_parent"
android:id="@+id/addressTextView"
android:text="Akkoor, Sakthikulangara, Kollam"
android:textColor="#000000"
/>
</TableRow>
</TableLayout>/>
</LinearLayout>
如果我在第三行中輸入很長的文字,這是什麼樣子
請加你一個scrrenshot期望? –
@KarthikaPB我編輯了我的帖子,請參閱。希望你現在明白我的問題 – HeisenBerg
查看我的回答 –