I want to play google play like scrollview

I need a game store, for example, viewing the horizontal scroll, but I can not reach it.

I tried this code, if possible, provide a link.

   <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
   <HorizontalScrollView 
   android:id="@+id/horizontalScrollView1" 
   android:layout_width="fill_parent" 
   android:layout_height="wrap_content"
   android:fillViewport="true"
   android:scrollbars="horizontal" >
<GridView
    android:layout_width="500dp"
    android:layout_height="400dp"
    android:id="@+id/gridview"
    android:columnWidth="300dp"
    android:numColumns="3"
    android:horizontalSpacing="10dp"
    android:scrollbars="horizontal">
</GridView>
 </HorizontalScrollView>
</RelativeLayout>

I need this kind of View in my application, please check the screenshot:

+4
source share
2 answers

You can use RecylerView for this.

 LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());    
    linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);

    RecylerView.setLayoutManager(linearLayoutManager);
+4
source

Add this to your application build.gradle file

dependencies {
    compile 'mobi.parchment:parchment:1.6.9@aar'

}

Here is a list of View

<mobi.parchment.widget.listview.ListView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:parchment="http://schemas.android.com/apk/res/<YOUR PACKAGE NAME>"
android:id="@+id/horizontal_list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="< horizontal | vertical >"
android:scrollbarAlwaysDrawHorizontalTrack="< true | false >"
android:scrollbarAlwaysDrawVerticalTrack="< true | false >"
android:clipToPadding="< true | false >"
parchment:isViewPager="< true | false >"
parchment:orientation="< horizontal | vertical >"
parchment:cellSpacing="10dp"
parchment:isCircularScroll="< true | false >"
parchment:snapPosition="< center | start | end | onScreen >"
parchment:snapToPosition="< true | false >" />

Well, you can try checking this out https://github.com/EmirWeb/parchment

+2
source

Source: https://habr.com/ru/post/1616366/


All Articles