2017-09-26 2 views
0

Je suis en train de mettre en œuvre un écran comme celui-ci:Besoin de conseils sur la façon d'implémenter cette vue dans Android?

enter image description here

La vue pourrait être et à l'intérieur d'un défilement horizontal chacun d'eux, ils pourraient être de défilement vertical. Le nombre d'éléments dans chacun est arbitraire.

Actuellement, je pense à la mettre en œuvre en utilisant un recyclerview dans un recyclerview mais y a-t-il un moyen plus facile de le faire?

+2

horizontal peut être fait avec ViewPager ... On dirait que vous essayez de recréer la mise en application Trello –

+0

horizontale 'ViewPager' est mieux à utiliser pour vous! – kimkevin

Répondre

0

Vous pouvez utiliser une vue déroulante et ajouter des vues par programmation dans cette vue défilante. Mais j'ai recommandé recyclerview.

int countOfViews = 20; 
LinearLayout root= findViewById(R.id.scrollViewRoot); 
for(int i = 0; i < countOfViews; i++) { 
    View child = getLayoutInflater().inflate(R.layout.item_test, null); 
    root.addView(child); 
} 

XML: item_test.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <LinearLayout 
     android:id="@+id/scrollViewRoot" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"></LinearLayout> 

</ScrollView>