joyDream
joyDream

Reputation: 27

android layout: how to put multi control in a layout, show 3 control each line

I want to design a layout to select cities. 3 city a line(It may be multiline). The control that indicate city may be textview, button or others. And I need to add city easily. which layout should I use and how can I config it correctly?

I have a idea that use a vertical linearlayout and a horizonal linearlayout to do that. but it's so complex and hard to add city dynamicly.

Upvotes: 0

Views: 141

Answers (1)

user994804
user994804

Reputation:

I think what you need is a GridView with android:numColumns set to 3. This way you should get a maximum of three city elements on a horizontal line and the amount of lines would increment as the amount of city elements grows.

http://developer.android.com/guide/topics/ui/layout/gridview.html

Upvotes: 1

Related Questions