user1865027
user1865027

Reputation: 3647

android-display multiple images and to next line if no enough room

I don't know if this is possible....the idea is just like TextView. text would go to next line if there is no enough room to display all. but instead of plain text, I want to do images. Lets say I want to display a random number of smiling face. can be 0 to 100. what I can think of now is having a LinearLayout, and just dynamically create ImageView then add it to the LinearLayout. depending on the orientation of the LinearLayout I ended up of having a row/column of partial smiling faces. even if I had a ScrollView, I'm able to see all the smiling faces but just in one row/column.

is there a way that I can dynamically load the next smiling face to the new line if there's no enough room?

Upvotes: 0

Views: 1139

Answers (1)

Artemio Ramirez
Artemio Ramirez

Reputation: 1136

Populate a gridview and it'll automatically send images into the next row/column if they dont fit.

<GridView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:numColumns="auto_fit"
    android:horizontalSpacing="2dp"
    android:verticalSpacing="2dp"/>

Upvotes: 1

Related Questions