gpt4 book ai didi

android - ListView 中的 ScrollView

转载 作者:搜寻专家 更新时间:2023-11-01 07:35:01 24 4
gpt4 key购买 nike

我有一个包含多行的 ListView ,其中一行必须是一个也包含多行的 ListView ,但只需要显示其中的 2 行,其余的仅在滚动时显示。我在 listview 布局文件中添加了一个带有 LinearLayout 的 ScrollView,并且我在 java 文件中添加了行的内容。 ScrollView 似乎不能很好地滚动。有没有更好的方法来实现这一目标?这是我的布局文件。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/listLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<ListView
android:id="@android:id/list"
android:layout_width="1px"
android:layout_height="1px"
android:layout_weight="1"
android:cacheColorHint="#00000000"
android:scrollbars="vertical" >
</ListView>

<RelativeLayout
android:id="@+id/listItem"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >

<ImageView
android:id="@+id/formImage"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY" />

<include layout="@layout/vertical_list_item_title_area" />
</RelativeLayout>


<ScrollView
android:id="@+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:layout_weight="1">

<LinearLayout
android:id="@+id/childListLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >

</LinearLayout>
</ScrollView>

<com.illumemobile.testapp.Classes.SCClasses.SCActivities.SCCustomActivities.SCCustomGallery
android:id="@+id/horizontallistview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:spacing="33dip" />

最佳答案

ListViews 内部的 ScrollViews 是一个非常非常糟糕的主意。这不仅让用户感到困惑,而且系统在确定哪个 View 应该获得触摸事件时也会出现问题。

我建议重新考虑您的布局。

关于android - ListView 中的 ScrollView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12694142/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com