0

I have an Android app with an image detail screen. Images have tags, and these need to be displayed at the bottom of the screen. When the horizontal space for tags is exhausted, they wrap to the next line up. Each tag should only occupy the minimum necessary horizontal space. Here is an image of the effect I need, from an iOS app:

enter image description here

How can I achieve this effect in Android?

James Harpe
  • 4,315
  • 8
  • 47
  • 74
  • Please don't prefix your questions titles with tag names like Android etc, the tags at the bottom are sufficient to state the target of the questions. What you're looking(almost, as I understand you want the views to go updwards) is a so called flow layout. Basic a custom layout that places its children on lines stacking them when the line is not sufficient enough in width to hold the children. – user Mar 31 '15 at 19:12
  • I was hoping for something like listview or gridview so I wouldn't have to manually add views. But if no such thing exists, flow layout might do the trick! – James Harpe Mar 31 '15 at 19:27
  • A ListView isn't really an option and neither a GridView(because it's a grid so you can't have staggered items in it). There's nothing stopping you from implementing the custom layout to take a list of tags and show them. – user Mar 31 '15 at 19:32
  • You can get this effect by using width="wrap_content". If you use listview your inflated view (cell) should have that xml element. – Emre Aktürk Apr 01 '15 at 10:42
  • possible duplicate of [How can I do something like a FlowLayout in Android?](http://stackoverflow.com/questions/4474237/how-can-i-do-something-like-a-flowlayout-in-android) – Lamorak Apr 01 '15 at 12:44

1 Answers1

1

You will need to implement such FlowLayout yourself or use some library. Have a look at this question.

Community
  • 1
  • 1
Lamorak
  • 10,957
  • 9
  • 43
  • 57