views:

77

answers:

1

I've got the following node in my XML layout:

<com.x.y.view.TagLayout android:id="@+id/TagLayout" 
android:layout_width="fill_parent" android:layout_height="170dip" />

TagLayout is a class that extends ViewGroup, and basically holds a bunch of buttons with text (a custom object that act as tags, but that's neither here or there).

The problem is that when there are too many buttons, the view no longer scrolls. I can confirm that I am adding tags but I can't see anything.

If I wrap the above within a ScrollView, the layout never renders. I tried adding the attributes android:isScrollContainer and android:scrollbars, but that doesn't change anything. Is there something I'm missing here?

I should also add that TagLayout is overriding the onMeasure() event. I guess I need to implement a scrolling mechanism there...?

A: 

Well, I mostly got it. I had to actually wrap the node above with a LinearLayout, then wrap THAT around a ScrollView. The padding is a little off (the last item is cut from the view) but it's on the right track.

GJTorikian