滚动视图内的列表视图无法正常工作

时间:2014-09-19 07:55:30

标签: android listview adapter expandablelistview

在我的滚动视图中,我有一个列表,列表是自定义列表视图。我正在使用Expnadable列表视图在滚动视图中显示列表视图。我的问题是当用户滚动列表时,所有列表数据都没有显示。 当我向下滚动并移动到列表底部时,则不显示最后一项,然后向上滚动时,不显示第一项列表。 然后我在一些其他片段上选项卡并进入列表视图,然后显示列表的最后一个otem,但只显示了一半的项目。 有滚动问题吗? 以下是我的代码 -

我在xml中的列表
 <ListView android:id="@+id/my_post_listview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:clickable="false" android:divider="@color/post_title_bg" android:dividerHeight="1dp" android:visibility="gone"/>

,我的加载适配器的代码是 -

    postList.setVisibility(View.VISIBLE);
    listAdapter = new ListAdapter(mContext, mList,fm);
    postList.setAdapter(listAdapter);
    ExpandableHeightListView.getListViewSize(postList);
    postList.setSelection(0);
    listAdapter.notifyDataSetChanged();

请参阅下面添加的图片 - enter image description here

你可以看到整个图像项目没有显示。它只显示了一半的项目。

请帮助解决这个问题。 提前谢谢。

更新

请参阅完整的xml -

<?xml version="1.0" encoding="utf-8"?>
    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
       android:layout_width="match_parent"
       android:layout_height="match_parent">

   <RelativeLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent">



<ImageView 
    android:id="@+id/user_profile_pic"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:src="@drawable/ic_launcher"/>


 <TextView 
    android:id="@+id/user_name"
    android:layout_below="@+id/user_profile_pic"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="user_name"/>

  <TextView 
    android:id="@+id/user_email"
    android:layout_below="@+id/user_name"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="user_email"/>

       <ListView 
          android:id="@+id/my_post_listview" 
          android:layout_below="@+id/user_email"
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:clickable="false" 
         android:divider="@color/post_title_bg" 
         android:dividerHeight="1dp" 
         android:visibility="gone"/>

       </RelativeLayout>

     </ScrollView>

0 个答案:

没有答案