表格视图不匹配全屏

时间:2013-04-13 05:41:13

标签: java android uitableview android-layout center

我设计了一个活动布局,在布局中我有两个彼此相邻的独立表。问题是表格不会按比例显示在屏幕上。

Image

如果您注意到屏幕截图,您将看到表格的左边距与右边的边距不同。如何使表格显示在屏幕中央?

xml布局

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:paddingBottom="3dp"
    android:paddingLeft="6dp"
    android:paddingRight="6dp"
    android:paddingTop="3dp"
    android:background="#FFFFFF"
    tools:context=".ReportListActivity" >

    <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true" >

        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" 
            android:background="@drawable/border"
            android:gravity="center">

            <RelativeLayout
                android:id="@+id/relativeLayout1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_centerVertical="true" >

                <TableLayout
                    android:id="@+id/srno_table"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_centerHorizontal="true"
                    android:layout_centerVertical="true">
                </TableLayout>
            </RelativeLayout>

            <RelativeLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_toRightOf="@+id/relativeLayout1" >
                <HorizontalScrollView
                android:id="@+id/horizontalScrollView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_toRightOf="@+id/relativeLayout1" >

                    <TableLayout
                        android:id="@+id/report_table"
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent" >


                    </TableLayout>

            </HorizontalScrollView>
            </RelativeLayout>



        </RelativeLayout>

    </ScrollView>

</RelativeLayout>

我哪里错了?我该怎么做才能达到预期的效果?

提前致谢!

0 个答案:

没有答案