开发者

wrap_content, fill_parent or the dp will guarantee that the view is given an appropriate size on the current device screen

开发者 https://www.devze.com 2023-01-29 17:00 出处:网络
How wrap_content, fill_parent or the dp will guarantee that the view is given an appropriate size on the开发者_StackOverflow current device screen in android platform.Only wrap_content and fill_parent

How wrap_content, fill_parent or the dp will guarantee that the view is given an appropriate size on the开发者_StackOverflow current device screen in android platform.


Only wrap_content and fill_parent will adapt to the size of the screen.

Sizes declared in dip will be adapted to the resolution of the screen, but not to the size (100dip will be the same physical length (for example 1 inch), so it won't take the same proportion of the screen on a small device and a large one.

Sizes declared in px will not be adapted at all.

So if you want to develop an application for different devices sizes and resolutions, i suggest you create layouts and drawable directories, as described in the framework.


wrap_content takes the actual size of the child....

fill_parent takes the size of the parent....

dp takes the size of what you given...


For the the difference between fill_parent and wrap_content, see the answers for this question

And about dp, see this documentation on how android support a range of screen sizes and resolutions

For the better understanding of layout objects, please have a look on below documentation pages

  • User Interface
  • Common Layout Objects
0

精彩评论

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

关注公众号