0

我在 Scrollview 中有一个 TableLayout,我想在 ScrollView=>TableLayout 的底部设置一个 FIXED RelativeLayout。使用该 XML 代码,我总是在 TableLayout 上方使用 RelativeLayout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:glowpad="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/classement_layout"
    android:background="#000000">


    <ScrollView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="#FFFFFF"
        android:scrollbarFadeDuration="1000"
        android:id="@+id/scroll_table"
        android:scrollbarSize="12dip" >

        <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/tableLayout1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:shrinkColumns="*"
            android:stretchColumns="*"
            android:background="#000000" >

        </TableLayout>

    </ScrollView>

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="80dp"
        android:layout_alignBottom="@+id/scroll_table"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true" >

       <ImageView
           android:id="@+id/imageView1"
           android:layout_width="20dp"
           android:layout_height="20dp"
           android:layout_alignParentLeft="true"
           android:layout_alignParentTop="true"
           android:layout_marginLeft="22dp"
           android:src="@drawable/green" />

       <TextView
           android:id="@+id/textView1"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_alignParentTop="true"
           android:layout_toRightOf="@+id/imageView1"
           android:text="Qualification pour la ligue des champions" 
           android:textColor="#ffffff"/>

       <ImageView
           android:id="@+id/imageView2"
           android:layout_width="20dp"
           android:layout_height="20dp"
           android:layout_alignLeft="@+id/imageView1"
           android:layout_centerVertical="true"
           android:src="@drawable/blue" />
    </RelativeLayout>

</RelativeLayout>
4

1 回答 1

1

只需将您的表格布局封装在另一个相对布局中,然后将您的“页脚”相对布局放在表格布局下方,并使用页脚上的 layout_below 属性将其保持在表格布局之下

<ScrollView>
<RelativeLayout
   stuff...>

      <TableLayout
         stuff.../>

      <RelativeLayout
         android:layout_below="@+id/TableLayout"
         stuff...></RelativeLayout>

</RelativeLayout>
</ScrollView>

为了始终将“页脚”RelativeLayout 放在底部,只需像这样放置它:

<ScrollView>
<RelativeLayout
   stuff...>

      <TableLayout
         stuff.../>

</RelativeLayout>
</ScrollView>

<RelativeLayout
    android:layout_below="@+id/ScrollView"
 stuff...></RelativeLayout>
于 2013-01-16T00:58:03.313 回答