【发布时间】:2016-04-01 05:03:25
【问题描述】:
我想创建一个图片库,其中TextView 作为标题,ImageViews 在HorizontalScrollView 中,就像它显示在这个figure 中一样。
我使用RecyclerView来减少我的应用程序的资源并使用许多ArrayList 来实现图像:
itemFotoIDs.addAll(Arrays.asList(
R.drawable.cable_crunches_1
,R.drawable.dips_1
,R.drawable.kabelrudern_breit_1
,R.drawable.kabelrudern_eng_1
,R.drawable.klimmzug_1
,R.drawable.kh_schulterdruecken_1
,R.drawable.kh_curls_1
,R.drawable.lh_bankdruecken_1
,R.drawable.lh_bankdruecken_eng_1
,R.drawable.lh_kniebeuge_1
,R.drawable.lh_kreuzheben_1
,R.drawable.lh_schraegbankdruecken_1
,R.drawable.latzug_obergriff_1
,R.drawable.seitheben_1
,R.drawable.szhantel_curls_1
));
现在我的问题是:在 ArrayList 的一行中创建一个空条目的最佳解决方案是什么,例如我有五个 ArrayList 有 15 个条目,两个只有 14 或 13 个条目。但我希望在确切的行而不是最后的空条目。
我尝试实现 null 而不是 R.drawable. 但这会导致应用程序崩溃。
【问题讨论】:
-
是否要在可绘制对象为空时显示默认图像?
-
这是有可能的。但是不,我不想显示默认图像,因为 HorizontalScrollView 应该在每个 raw 的最后一个图像之后停止。
标签: android arraylist null android-recyclerview horizontalscrollview