What is the correct way to position controls in a RelativeLayout so that it displays the same

对着背影说爱祢 提交于 2019-12-25 04:53:07

问题


What is the correct way to position controls in a RelativeLayout so that it displays the same irrespective of Device Resolution.I guess this is clear enough,If we use dp values in giving margins like android:layout_marginTop="17dp" It displays at different places on mdpi,xhdpi,hdpi.

Can someone give a full fledged guenine solution to it? Thanks


回答1:


You should have different layouts for different screen sizes. For example for xhdpi screens you create layout-xhdpi folder and put layout.xml for xhdpi screens in there. The same for other screen sizes. There is no way to have one layout looking exactly the same on all displays.

See this: http://developer.android.com/guide/practices/screens_support.html



来源:https://stackoverflow.com/questions/14640462/what-is-the-correct-way-to-position-controls-in-a-relativelayout-so-that-it-disp

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