2017-09-26 4 views
0

私はこのような画面を実現しようとしています:Androidでこのビューを実装する方法についてアドバイスが必要ですか?

enter image description here

ビューは水平方向にスクロールすることができ、それらのそれぞれの内側に、彼らは垂直方向にスクロールさせることができました。それぞれの項目の数は任意です。

現在、私はrecyclerview内でrecyclerviewを使用して実装することを考えていますが、これを行う簡単な方法はありますか?

+2

item_test.xml水平はViewPagerで行うことができますが...あなたは 'ViewPager'が優れている –

+0

水平Trelloアプリのレイアウトを再作成しようとしているように見えますあなたのために使用する! – kimkevin

答えて

0

scrollViewを使用して、プログラムでこのスクロールビューにビューを追加できます。しかし、私は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:

<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> 

関連する問題