Implementing custom View and/or ViewGroup (Flow Layout) in Android -
i'm trying achieve similar this:
so, container can hold arbitrary number of children. each child simple text border. children may differ width. assume part can implemented extending textview
widget (since isn't clickable). more interesting thing here container these bordered text views. should support regular addview(child)
operation automatically aligns child according simple rule: if there enough room within current row - place child right of last item in row. if there no space - move child next row. basic logic seems quite similar textview
or edittext
: if text long, display in several lines. idea extend relativelayout
, still hope find easier.
the scheme i've described above (custom container + custom textview
) not mandatory, i'm looking ways achieve this. thoughts guys?
seems pattern looking called flowlayout
(thanks nitzanj). there several of implementations of it:
if decide write own version, here helpful guides writing custom views:
Comments
Post a Comment