开发者

UI Layout problem/algorithm

I am trying to solve a problem where i need to fit a set of rectangles(views) in a bigger rectangle(window frame). Each View has a minimum size and a maximum size. Is there a general algorithm to solve this kind of problems. My current code does not look elegant although it works for most of the situations, i some times开发者_StackOverflow get into situations where i have empty rects(unoccupied regions) or overlapped rects (views overlapped). I am sure someone has already solved this problem, i just cannot find any yet.

Thanks, -Abhinay.


Often what is used is recursive subdivision, alternating horizontal and vertical directions. This is eg how Eclipse IDE works. Normally it is assumed that views or windows can grow arbitrarily large, they are then padded if there is not enough content.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜