Design custom subclasses of Android ViewGroup

Android Developer has a good discussion about writing custom View subclasses: http://developer.android.com/guide/topics/ui/custom-components.html

But I want to write my own subclass of ViewGroup with my own location policy. Where is a minimal example of this kind of thing? (This is a Java coding issue, not XML)

In particular, I want a horizontal layout that (like LinearLayout) fills the children on the left - but as soon as the horizontal space is consumed, it moves the children on the left to bring the last child to the right end of the layout. Children are like buttons, so HorzontalScrollView does not work, because it clicks the buttons with the scroll gesture rather than moving them.

If LinearLayout has the ability to do this, I could not find it.

+6
android design layout
source share
1 answer

HorizontalScrollView should work, scrolling should not click on buttons. But if you really want to write your own layout, look at this archive ( video is also available)

+10
source share

All Articles