[英]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文件,scrollview没有滚动。
有人可以提出解决方案吗?
我正在使用自定义适配器将自定义视图用于列表视图
不建议在彼此之间使用多个Scrollable视图。 您正在列表视图内使用ScrollView,但不应这样做。 这是一个坏习惯。
相反,您可以通过view.add()使用动态布局添加
滚动视图的高度为200dp。 由于屏幕可容纳200dp,因此没有任何可滚动的内容。 您可以尝试将高度设置为
android:layout_height="match_parent"
要么
android:layout_height="wrap_content"
如果UI项的高度大于屏幕尺寸。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.