There are different ways to utilize a ListView in a ScrollView without showing a scrollbar:
android:scrollbars
attribute to none
.<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none">
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
android:overScrollMode="never"
android:scrollbarStyle="outsideOverlay"/>
</ScrollView>
wrap_content
so that it only occupies the required height, and it will not require scrolling.<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
android:overScrollMode="never"
android:scrollbarStyle="outsideOverlay"/>
</ScrollView>
android:nestedScrollingEnabled
attribute to the ListView.<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
android:overScrollMode="never"
android:nestedScrollingEnabled="true"
android:scrollbarStyle="outsideOverlay"/>
</ScrollView>
Using any of the above methods, the ListView can be utilized in a ScrollView without a scrollbar.
Asked: 2022-03-08 11:00:00 +0000
Seen: 16 times
Last updated: Oct 10 '22