开发者

How to place view anywhere on screen?

On Android, what's a way to be able to place a view, like a WebView, anywhere on screen? I'm providing 开发者_运维百科an interface to users where they can create a WebView dynamically and place it anywhere they want with X-Y and Width-Height parameters.

FrameLayout doesn't work since it sticks everything at a corner. RelativeLayout I'm not sure of. AbsoluteLayout seems like the best bet, but it's been deprecated.


This answer did the trick:

Set the absolute position of a view


You could try loading your views into Pictures and using a SurfaceView to draw them dynamically onto a Canvas. This would avoid using deprecated stuff, but to be honest I can't really see how it's any better than using an AbsoluteLayout. You would still have the problem of having to specify your position in pixel units, which is why I assume AbsoluteLayout has been deprecated.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜