3

我正在创建自定义ViewGroup,我onLayout在其中使用我调用的方法addViewInLayout()ViewGroup但它是View水平添加唯一的。

如何强制它像AndroidView一样垂直添加ListView

寻求帮助。

4

1 回答 1

5

您可以尝试通过指定位置

child.layout(int left, int top, int right, int bottom)

如果您已经测量了视图组中的其他视图,那么您应该能够获得最底部视图的底部

child.layout(left, viewAbove.getBottom(),right, viewAbove.getBottom()+heightOfTheChild);
于 2011-12-05T11:24:37.397 回答