scrollview - Android Material CardView with HorizontalScrollView -


i need show cardviews in horizontalscrollview below tutorial http://examples.javacodegeeks.com/android/core/ui/horizontalscrollview/android-horizontalscrollview-example/

and here i've tryed:

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:card_view="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="horizontal"     android:weightsum="3">      <horizontalscrollview         android:id="@+id/horizontalscrollview"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_margintop="50dp">          <relativelayout             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:orientation="horizontal">              <android.support.v7.widget.cardview                 android:id="@+id/view2"                 android:layout_width="170dp"                 android:layout_height="220dp"                 android:layout_alignparentend="true"                 android:layout_aligntop="@+id/horizontalscrollview"                 android:clickable="true"                 android:foreground="?android:attr/selectableitembackground"                 card_view:cardcornerradius="3dp"                 card_view:cardelevation="3sp"                 card_view:cardusecompatpadding="true" />         </relativelayout>     </horizontalscrollview>      <android.support.v7.widget.cardview         android:id="@+id/view5"         android:layout_width="170dp"         android:layout_height="220dp"         android:clickable="true"         android:foreground="?android:attr/selectableitembackground"         card_view:cardcornerradius="3dp"         card_view:cardelevation="3sp"         card_view:cardusecompatpadding="true"         android:layout_aligntop="@+id/horizontalscrollview"         android:layout_alignparentend="true"         android:layout_marginend="33dp" />   </relativelayout> 

but can't use more 2 cardview in layout.(inhorizontalscrollview)

should use widget porpose or problem if need show 5 cardview in horizontal scrollview?

cheers!

you can use recyclerview comes in android support library , u can see how add project here. better implementation on list view comes layout manager can configure used horizontal or vertical scroll mode.

mrecyclerlayoutmanager.setorientation(linearlayoutmanager.horizontal); 

Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -