Android 滚动视图中的列表视图工作不正常
在我的滚动视图中,我有一个列表,列表是自定义列表视图。我使用可扩展列表视图在滚动视图中显示列表视图。我的问题是,当用户滚动列表时,所有列表数据都不显示。 当我向下滚动并移动到列表的底部时,最后一项不显示,然后向上滚动时,列表的第一项不显示。 然后我在另一个片段上单击tab键,进入列表视图,然后显示列表的最后一个otem,但只显示了该项的一半。 是否存在任何滚动问题。 下面是我的代码- 我的xml列表 我加载适配器的代码是- 请参阅下面添加的图片- 您可以看到整个图像项目未显示。它仅显示项目的一半 请帮助解决这个问题,。 提前谢谢 更新 请参阅完整的xml-Android 滚动视图中的列表视图工作不正常,android,listview,adapter,expandablelistview,Android,Listview,Adapter,Expandablelistview,在我的滚动视图中,我有一个列表,列表是自定义列表视图。我使用可扩展列表视图在滚动视图中显示列表视图。我的问题是,当用户滚动列表时,所有列表数据都不显示。 当我向下滚动并移动到列表的底部时,最后一项不显示,然后向上滚动时,列表的第一项不显示。 然后我在另一个片段上单击tab键,进入列表视图,然后显示列表的最后一个otem,但只显示了该项的一半。 是否存在任何滚动问题。 下面是我的代码- 我的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>
为什么在ScrollView中需要ListView?这两者不应该一起工作。根据我上面的应用程序设计,我必须显示一些包含,然后列出,这就是为什么我必须使用它。你能发布你的布局XML并准确显示你需要什么吗?也许有更好的方法来实现这一点,因为ScrollView中的ListView不会真正起作用。@nitzanj请查看更新的问题我不知道如何才能顺利工作。我会重新思考用户体验,并想出一些不涉及滚动的东西。Android的小部件不是用来处理同一轴上的内部滚动的。
<?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>