0
我想实现的画面是这样的:需要关于如何在Android中实现这个视图的建议?
视图可以水平滚动和内部的每个人,他们可以垂直滚动。每个项目的数量是任意的。
目前我正在考虑在recyclerview中使用recyclerview来实现它,但有没有更简单的方法来做到这一点?
我想实现的画面是这样的:需要关于如何在Android中实现这个视图的建议?
视图可以水平滚动和内部的每个人,他们可以垂直滚动。每个项目的数量是任意的。
目前我正在考虑在recyclerview中使用recyclerview来实现它,但有没有更简单的方法来做到这一点?
您可以在此滚动视图中使用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: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>
水平可与ViewPager做...貌似你试图重建Trello应用布局 –
水平'ViewPager'更好为您使用! – kimkevin