Alex
Alex

Reputation: 547

How can I place several ImageViews side by side?

Ok, so I am trying to create a layout that has side by side image views in a listview. Here would be an example of what I'm trying to achieve. However, I'm really not sure how I should be doing this. Here is an example of what I have found online. The problem is that once you start adding more imageviews it just adds them to the same line and not below the current ones.

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

Would a listview be a better method of displaying these images side by side or should I be doing it with XML as such?

Upvotes: 0

Views: 127

Answers (1)

StuckPixel
StuckPixel

Reputation: 111

You should use grid view for this and use this

android:numColumns=" " in your gridView xml.

Upvotes: 1

Related Questions