Search code examples
androidandroid-gridviewandroid-scrollview

how to have a horizontal gridview at the end of scrollview


I have a scrollview that contain details of an item in my android app, what I need is to add a horizontal list of similar items (each inflate from a layout) at the end of this view. can anybody tell me how to do this?

P.S: I've tried Recyclerview and gridview and a library form this link but all of them are not working inside the scrollview !!!


Solution

  • Take a look at recent-images Library. It provides horizontal gridview(one row). Just add this library dependency and put below code in bottom of your scrollView.

    <com.jess.ui.TwoWayGridView
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:background="#E8E8E8"
    android:id="@+id/gridview"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    app:columnWidth="70dp"
    app:rowHeight="70dp"
    app:numColumns="auto_fit"
    app:numRows="auto_fit"
    app:verticalSpacing="16dp"
    app:horizontalSpacing="16dp"
    app:gravity="center"/>