【发布时间】:2013-12-15 23:50:30
【问题描述】:
我在RelativeLayout 中有一个TableLayout,其中android:layout_centerInParent="true" 作为其属性之一,但它没有垂直居中。
这是我的 xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/line_drawing_relativelayout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TableLayout
android:id="@+id/activity_linking_tl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" >
<TableRow
android:id="@+id/table_row_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="1dp" >
<com.xx.myview
android:id="@+id/id_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<com.xx.myview
android:id="@+id/id_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
</TableLayout>
<ImageButton
android:id="@+id/line_drawing_b_restart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:padding="22dp"
android:src="@drawable/ic_restart" >
</ImageButton>
<!-- There are more views/widgets here -->
</RelativeLayout>
我将如何解决这个问题?
【问题讨论】:
标签: android android-layout tablelayout android-tablelayout