Is modifying the dp size as opposed to pixels recommended for various screen sizes?

こ雲淡風輕ζ 提交于 2019-12-04 06:35:54

问题


Say, for an ImageButton on screen A (240X320: ldpi) and screen B (720X1280: xhdpi), is it recommended to manually change the dp (layout-width and height) size of it in each unique layout resource file for various screens? Or, create scaled nine-patch bitmaps for each dpi size of the image, call it on the drawable resource file, and then set it as the src for the ImageButton?

To justify, here's what I mean: https://www.youtube.com/watch?v=OtsZbdbC370 ... Most likely, the video is outdated, correct?


回答1:


It is entirely up to you if you want to change the layout width and height (in dp) of an imageButton. There is certainly nothing wrong with setting width and height of an imageButton or any UI element for that matter, in each unique layout resource file for various screens. Did you have specific code you wanted to get feedback about?



来源:https://stackoverflow.com/questions/36046531/is-modifying-the-dp-size-as-opposed-to-pixels-recommended-for-various-screen-siz

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!