0

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

图片

如果您注意屏幕截图,您会看到表格的左边距与右边不一样。我应该怎么做才能使表格出现在屏幕中央?

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>

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

提前致谢!

4

0 回答 0