0

I need to make an edit text with selected items in box in the edit text like the facebook tag friends.

enter image description here

i tried to do it by placing an edit text inside an linearlayout with orientation horizontal. and when the an item is selected it is added to to the linarlayouts first position. But this didn't work as the linear layout don't come to the next line when the first line is filled. can somebody tell me what is the proper way to achieve this.

null pointer
  • 5,874
  • 4
  • 36
  • 66

2 Answers2

0

You can use horizontal linear layouts as rows inside a vertical linear layout. To do this, you should know when you would need a new horizontal layout before putting a new textview in it. For that, you have to calculate the size of each textview before you put them in the layout. The following question might help to calculate the measured size of a textview: How to Measure TextView Height Based on Device Width and Font Size?

In fact, you just need a FlowLayout which is missing on Android. You have to create your own custom layout. Fortunately, there is a good one already developed in the answer of the following question: How can I do something like a FlowLayout in Android?

Community
  • 1
  • 1
Timuçin
  • 4,653
  • 3
  • 25
  • 34
0

Try the SDK's MultiAutoCompleteTextView

Oded Breiner
  • 28,523
  • 10
  • 105
  • 71