固定页脚不显示最下面的列表项 [英] Fixed footer not displaying the bottom-most list item

查看:139
本文介绍了固定页脚不显示最下面的列表项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的XML布局:

Here is my XML layout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
 <ListView xmlns:android="http://schemas.android.com/apk/res/android"
   android:id="@android:id/list" 
  android:orientation="vertical"
  android:layout_width="fill_parent" 
  android:layout_height="wrap_content">
 </ListView>

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_height="wrap_content"
     android:layout_width="fill_parent"
     android:layout_alignParentBottom="true">
    <EditText xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent" 
        android:layout_weight="1" />
    <Button xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:layout_weight="2" />
 </LinearLayout>
</RelativeLayout>

这会导致这个问题:

列表视图项(用红色标出)是固定页脚后面,并且不能使用。任何解决办法?
更新:
我想preFER指出的的变化,我的code,以解决这个问题,然后某种解释。但是,这只是我的preference。

Which causes this problem:

The listview item (outlined in red) is behind the fixed footer and cannot be used. Any solutions?
UPDATE:
I would prefer to be pointed out the changes in my code to fix that problem and then some sort of explanation. But that's just my preference.

推荐答案

我刚刚找到了如何。通过利用 RelativeLayout的,并通过改变code到这一点:

I just found out how. By utilizing the RelativeLayout and by changing the code to this:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/root"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <LinearLayout
       android:id="@+id/listview_footer"
       android:layout_height="wrap_content"
       android:layout_width="fill_parent"
       android:layout_alignParentBottom="true">
       <EditText
           android:id="@+id/new_task_title"
           android:layout_height="wrap_content"
           android:layout_width="fill_parent" 
           android:layout_weight="1"
           android:hint="Add a new task" />
       <Button
           android:id="@+id/new_task_button"
           android:layout_height="wrap_content"
           android:layout_width="fill_parent"
           android:layout_weight="3"
           android:text="+" />
    </LinearLayout>

    <ListView
        android:id="@android:id/list" 
        android:orientation="vertical"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:layout_below="@id/root"
        android:layout_above="@id/listview_footer">
    </ListView>
</RelativeLayout>

这篇关于固定页脚不显示最下面的列表项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆