[英]Question about DP in Android
假设我更喜欢使用“ dp”,而不是“ fill_parent”或“ wrap_content”,那么使用什么合适的数字来填充图片?
This depends of the screen and of its density. 这取决于屏幕及其密度。 Check this article to learn more about that. 检查本文以了解更多有关此的内容。
(This may lead you to reconsider using fill_parent
/ wrap_content
by the way). (这可能会导致您重新考虑使用fill_parent
/ wrap_content
)。
Why would you "prefer" this? 您为什么会“偏爱”这个? Precise dp values for layout_width
/ layout_height
are one tool alongside match_parent
and wrap_content
and building a nice UI will usually involve all three. 精确的layout_width
/ layout_height
dp值是match_parent
和wrap_content
旁边的一种工具,构建一个漂亮的UI通常会涉及所有这三个。 Which one is appropriate for each dimension of any given View is situational and match_parent
's entire reason for existence is to match the size of a View's container, in your case the screen. 哪种情况适合任何给定View的每个维度都是match_parent
的,并且match_parent
存在的全部原因是要匹配View容器的大小(在您的情况下为屏幕)。
(* match_parent
is the newer name for fill_parent
.) (* match_parent
是fill_parent
的较新名称。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.