当页脚出现时,片段Listview的最后两项不显示



您好,我有一个包含4个片段的"活动"。"活动"有一个页脚,我用它在这些片段视图之间切换。现在,在我的一个片段中,我有一些小部件,最后一个小部件是ListView。问题是,Listview中的最后两个条目显示不正确!它们被页脚遮住了。我已经为ListviewFILL_PARENT的宽度和高度设置了LayoutParameters。但它不起作用。知道我该怎么解决这个问题吗?提前谢谢。

我的布局是:

对于片段:

<?xml version="1.0" encoding="utf-8"?>  
<RelativeLayout  xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" 
android:layout_height="match_parent"
android:orientation="vertical">
<Button android:id="@+id/line_button_id" android:layout_width="160dp"
android:layout_height="wrap_content" android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" android:layout_marginLeft="5dp" android:focusable="true"
android:layout_marginTop="8dp" android:text="@string/line_graph" android:background="@drawable/temp_left_button" />
<Button android:id="@+id/bar_button_id" android:layout_width="160dp"
android:layout_height="wrap_content" android:layout_alignBaseline="@+id/line_button_id"
android:layout_alignBottom="@+id/line_button_id" android:focusable="true"
android:layout_alignParentRight="true" android:layout_marginRight="5dp"
android:text="@string/bar_graph" android:background="@drawable/temp_right_button"></Button>"
<FrameLayout 
android:id="@+id/graph_framelayout_id"
android:layout_width="fill_parent"
android:layout_height="280dp"
android:layout_below="@id/line_button_id"
android:padding="4dp"
android:layout_margin="4dp"
android:background="@drawable/rounded_date_filter">
</FrameLayout>
<!-- first cell information, dashboard -->
<LinearLayout
android:id="@+id/row1_id" 
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:layout_below="@id/graph_framelayout_id"
android:orientation="horizontal"
android:clickable="true"
android:background="@drawable/rounded_table_row">
<TextView 
android:id="@+id/dashboard_datefrom_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:layout_marginLeft="20dp"
android:text="01 may 2012"/>
<ImageView 
android:id="@+id/dashboard_image_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/ic_action_search"/>
<TextView 
android:id="@+id/dashboard_dateto_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:text="01 sept 2012"/>
</LinearLayout>
<!-- accounts overview listview -->
<LinearLayout 
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/row1_id"
android:layout_margin="4dp"
android:orientation="vertical"
android:background="@drawable/rounded_date_filter">
<TextView 
android:id="@+id/list_text_header_id"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="2dp"
android:text="@string/data_grid_text_header_day"
android:background="@drawable/text_header">
</TextView>
<ListView
android:id="@android:id/list" 
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</ListView>
</LinearLayout>
</RelativeLayout>

对于活动,我有这个:

<

?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<FrameLayout
android:id="@+id/fragment_container_id"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</FrameLayout>
<include layout="@layout/footer"></include>"
</RelativeLayout>

我在活动的框架布局中用替换碎片

您在Fragment中使用的是什么布局,如果您使用RelativeLayout并将以上属性设置为ListView,则肯定不会发生这种情况:

尝试将其添加到"活动"布局中的FrameLayout中。

android:layout_above="@+id/footer"

最新更新