1

我有从 json 解析到 listview 的显示数据,它会正确显示,但是当我滚动 listview 时,底部的一些数据无法滚动......意味着我的 listview 没有正确滚动......

这是我的xml文件:

<LinearLayout 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:background="@drawable/leather_background_port"
   android:orientation="vertical"
   tools:ignore="ContentDescription,NestedScrolling,ObsoleteLayoutParam" >

<RelativeLayout
    android:id="@+id/RelativeLayout1"
    android:layout_width="match_parent"
    android:layout_height="45dp"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:background="@drawable/navbar_land" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:gravity="center"
        android:text="@string/Friends"
        android:textColor="#FFFFFF"
        android:textSize="18sp"
        android:textStyle="bold" />

    <Button
        android:id="@+id/btnedtfriends"
        android:layout_width="50dp"
        android:layout_height="30dp"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:layout_marginRight="5dp"
        android:background="@drawable/navbar_icon_land"
        android:text="@string/Edit"
        android:textColor="#FFFFFF"
        android:textSize="12sp"
        android:textStyle="bold" />
</RelativeLayout>

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <RelativeLayout
        android:id="@+id/relativeLayout1"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_below="@+id/RelativeLayout1"
        android:layout_marginTop="1dp"
        android:background="@drawable/search_bar_new_land" >

        <EditText
            android:id="@+id/editText1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_marginBottom="4dp"
            android:layout_marginLeft="7dp"
            android:layout_marginRight="4dp"
            android:layout_marginTop="8dp"
            android:layout_toRightOf="@+id/imageView1"
            android:ems="10"
            android:gravity="right"
            android:hint="@string/Status"
            android:singleLine="true"
            android:textSize="14sp" />

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="15dp"
            android:layout_height="20dp"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:layout_marginLeft="15dp"
            android:src="@drawable/black_search" />

        <Button
            android:id="@+id/btncancel"
            android:layout_width="15dp"
            android:layout_height="15dp"
            android:layout_alignBottom="@+id/imageView1"
            android:layout_alignRight="@+id/editText1"
            android:layout_marginRight="4dp"
            android:background="@drawable/cancelbtn"
            android:visibility="gone" />
    </RelativeLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <ListView
            android:id="@android:id/list"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:drawSelectorOnTop="true"
            android:fadingEdge="none"
            android:scrollbars="vertical"
            android:smoothScrollbar="true" >
        </ListView>
    </LinearLayout>
</LinearLayout>

4

1 回答 1

0

The Heights of your internal layouts seems all messed up. Avoid using fixed sizes for the layouts while you are using wrap_content for their internal elements. Internal elements could go invisible if their size exceed their parent.

于 2013-07-12T08:28:45.540 回答