[英]Android layout folder on different devices
我已經為Android開發了一個應用,我需要在不同的設備上運行我的應用,尤其是在分辨率為1280x720和480x800的設備上。
我必須創建哪些布局文件夾?
提前致謝。
我最近完成了我的應用程序,並且沒有使用任何屏幕尺寸限定符,而是使用了屏幕密度和最小寬度限定符:
layout/layout-land
layout-sw480dp/layout-sw480dp-land
layout-sw6000dp/layout-sw600dp-land
layout-sw720dp/layout-sw720dp-land
我還在上述相同文件夾和mdpi / hdpi / xhdpi / xxhdpi中使用了dimens.xml文件。
我不是專家。.我使用Android已有大約兩個月的時間,但這是我可以提供的幫助;)
布局不基於v19或v1版本(基於設備分辨率采用):
layout // layout for normal screen size ("default")
layout-large // layout for large screen size
layout-xlarge // layout for extra-large screen size
layout-xlarge-land // layout for extra-large in landscape orientation
更多詳細信息,請檢查: http : //developer.android.com/guide/practices/screens_support.html
這樣的布局文件夾。
res/layout/my_layout.xml // layout for normal screen size ("default")
res/layout-small/my_layout.xml // layout for small screen size
res/layout-large/my_layout.xml // layout for large screen size
res/layout-xlarge/my_layout.xml // layout for extra large screen size
res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation
在清單中添加支持屏幕
<supports-screens android:resizeable=["true"| "false"]
android:smallScreens=["true" | "false"]
android:normalScreens=["true" | "false"]
android:largeScreens=["true" | "false"]
android:xlargeScreens=["true" | "false"]
android:anyDensity=["true" | "false"]
android:requiresSmallestWidthDp="integer"
android:compatibleWidthLimitDp="integer"
android:largestWidthLimitDp="integer"/>
有關更多信息,請參見http://www.kandroid.org/guide/practices/screens_support.html和http://developer.android.com/guide/practices/screens_support.html
對於1280x720(4.7英寸),您需要創建
res/layout-xhdpi/urxml
res/drawable-xhdpi/urresorces
values-xhdpi/dimens //add dimensions
對於480 x 800(4.英寸),您需要創建
res/layout-hdpi/urxml
res/drawable-hdpi/urresorces
values-hdpi/dimens //add dimensions
再次使用480 x 800(5.1英寸),您需要創建
res/layout-large-mdpi/urxml
res/drawable-large-mdpi/urresorces
values-large-mdpi/dimens //add dimensions
有關更多信息,請參閱我的評論
限制特定設備的鏈接
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.