Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add horizontal scroll on vertical recyclerview?

So i have a recyclerview like this :

enter image description here

as you can see, the screen width is not enough for displaying all the text nicely, so i need to add horizontal scroll so user can scroll horizontally and vertically at the same time, how do i do this?

like image 429
Ardi Sugiarto Avatar asked Oct 20 '25 21:10

Ardi Sugiarto


1 Answers

Use HorizontalScrollView with LinearLayout as child. Set it's Orientation to horizontal and add your dynamic views to it.

<?xml version="1.0" encoding="utf-8"?>
<HorizontalScrollView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_height="wrap_content"
        android:layout_width="match_parent">

    <LinearLayout
            android:id="@+id/ll_main"
            android:orientation="horizontal"
            android:layout_width="wrap_content"
            android:layout_height="match_parent">
            // Add your dynamic views to this layout.
    </LinearLayout>

</HorizontalScrollView>
like image 58
karan Avatar answered Oct 22 '25 11:10

karan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!