0
我的TableLayout有問題。我無法正確顯示所有四個按鈕。此外,我希望圓形徽章能正確顯示在文字上方而不是文字上。添加「第四個」按鈕後表格佈局中的按鈕對齊不正確
如何更正此問題。提前致謝!!
按鈕佈局:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center" >
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true"
android:gravity="bottom" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#092435"
android:gravity="center_horizontal" >
<Button
android:id="@+id/btnManualLookup"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#4982AE"
android:gravity="center"
android:padding="10dip"
android:text="Button One"
android:textColor="#ffffff" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="6dip"
android:layout_marginTop="6dip"
android:background="#85929B" />
<Button
android:id="@+id/supportbutton"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#092435"
android:gravity="center"
android:padding="10dip"
android:text="Button Two"
android:textColor="#ffffff" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="6dip"
android:layout_marginTop="6dip"
android:background="#85929B" />
<Button
android:id="@+id/messagebutton"
android:layout_width="0dp"
android:layout_weight="1"
android:background="#092435"
android:gravity="center"
android:padding="10dip"
android:text="Button Three"
android:textColor="#ffffff" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="6dip"
android:layout_marginTop="6dip"
android:background="#85929B" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<Button
android:id="@+id/survey"
android:background="#092435"
android:text="Button Four"
android:layout_weight="1"
android:padding="10dip"
android:gravity="center"
android:textColor="#ffffff"
android:layout_width="65dip"
android:layout_height="65dip" />
<TextView
android:id="@+id/textOne"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@id/survey"
android:layout_alignTop="@id/survey"
android:background="@drawable/badge_circle"
android:text="10"
android:textColor="#FFF"
android:textSize="16sp"
android:textStyle="bold" />
</RelativeLayout>
</TableRow>
</TableLayout>
</LinearLayout>
badge_circle.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<corners
android:radius="10dip"/>
<solid
android:color="#F00"/>
<stroke
android:width="2dip"
android:color="#FFF"/>
<padding
android:left="5dip"
android:right="5dip"
android:top="5dip"
android:bottom="5dip"/>
</shape>
你爲什麼使用TableLayout?線性佈局這件事情要簡單得多。 – activesince93
您可以使用線性佈局還是需要使用表格佈局,因爲它變得簡單,並且可以在線性佈局而不是表格佈局中良好工作。 –