【问题标题】:How can I place several ImageViews side by side?如何并排放置多个 ImageView?
【发布时间】: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 来实现?

【问题讨论】:

标签: android xml listview imageview


【解决方案1】:

你应该为此使用网格视图并使用它

android:numColumns=" " 在您的 gridView xml 中。

【讨论】:

  • 我一定会尝试并报告。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-08-23
  • 2017-03-10
  • 2011-08-13
  • 2013-08-01
  • 1970-01-01
相关资源
最近更新 更多