【发布时间】:2016-08-14 04:35:35
【问题描述】:
好的,所以我正在尝试创建一个在列表视图中具有并排图像视图的布局。 Here 将是我想要实现的一个例子。但是,我真的不确定我应该怎么做。这是我在网上找到的一个例子。问题是,一旦您开始添加更多图像视图,它只会将它们添加到同一行,而不是当前行的下方。
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="15dip"
android:paddingBottom="15dip">
<ImageView android:id="@+id/numberDays"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitStart"
android:layout_weight="1"
android:src="@drawable/placeholder1" />
<ImageView android:src="@drawable/placeholder1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:scaleType="fitStart"
android:layout_weight="1"
android:id="@+id/daysText"></ImageView>
</LinearLayout>
列表视图是并排显示这些图像的更好方法,还是应该使用 XML 来实现?
【问题讨论】:
-
请使用gridview来实现
-
如果图片数量不固定,ListView或者RecyclerView比较好。我推荐你使用 RecyclerView 和 GridLayoutManager。这是示例blog.sqisland.com/2014/12/…
标签: android xml listview imageview