Let's say I prefer using "dp" rather than "fill_parent" or "wrap_content", what would be the appropr开发者_JAVA百科iate number to use in order to fill the screen with a picture?
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).
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. 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.
(* match_parent
is the newer name for fill_parent
.)
精彩评论