滚动视图不在列表视图的自定义视图内滚动
Scrollview is not scrolling inside a custom view for a listview
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="140dp"
android:background="@color/colorPrimary">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="200dp"
android:layout_alignParentBottom="true"
android:layout_below="@+id/image"
android:layout_centerHorizontal="true"
android:fillViewport="true"
android:scrollbars="vertical"
>
<TextView
android:id="@+id/prayerMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="please God forgive me for all my mistakes i have ever done in my life please God forgive me for all my mistakes i have ever"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#ffffff"
/>
</ScrollView>
</RelativeLayout>
这是我的 xml 文件,滚动视图没有滚动。
任何人都可以提出解决方案吗?
我正在使用自定义适配器为列表视图使用自定义视图
滚动视图的高度为 200dp。由于 200dp 适合屏幕,因此无需滚动。您可以尝试将高度设置为
android:layout_height="match_parent"
或
android:layout_height="wrap_content"
如果您的 UI 项目的高度大于屏幕尺寸。
不建议在另一个内部使用多个可滚动视图。您在列表视图中使用 ScrollView,您不应该这样做。这是一种不好的做法。
相反,您使用动态布局添加通过
view.add()
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="140dp"
android:background="@color/colorPrimary">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="200dp"
android:layout_alignParentBottom="true"
android:layout_below="@+id/image"
android:layout_centerHorizontal="true"
android:fillViewport="true"
android:scrollbars="vertical"
>
<TextView
android:id="@+id/prayerMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="please God forgive me for all my mistakes i have ever done in my life please God forgive me for all my mistakes i have ever"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#ffffff"
/>
</ScrollView>
</RelativeLayout>
这是我的 xml 文件,滚动视图没有滚动。
任何人都可以提出解决方案吗?
我正在使用自定义适配器为列表视图使用自定义视图
滚动视图的高度为 200dp。由于 200dp 适合屏幕,因此无需滚动。您可以尝试将高度设置为
android:layout_height="match_parent"
或
android:layout_height="wrap_content"
如果您的 UI 项目的高度大于屏幕尺寸。
不建议在另一个内部使用多个可滚动视图。您在列表视图中使用 ScrollView,您不应该这样做。这是一种不好的做法。
相反,您使用动态布局添加通过 view.add()