Android支持多分辨率多布局文件夹

Android支持多分辨率多布局文件夹,android,android-layout,screen-resolution,Android,Android Layout,Screen Resolution,现在我支持多个布局文件夹的多分辨率。 我正在使用android development studio,我制作了3个不同的文件夹 layout layout-large-port-1280x720 layout-normal-port-800x480 我在800x480和1280x720上进行了测试。480x800运行良好,但1280x720遵循800x480文件夹的dp和UI 我不知道为什么这件事会发生在我身上,我也不知道如何解决这个问题。 为什么它不起作用?我应该怎么做?确保您在drawa

现在我支持多个布局文件夹的多分辨率。 我正在使用android development studio,我制作了3个不同的文件夹

layout
layout-large-port-1280x720
layout-normal-port-800x480 
我在800x480和1280x720上进行了测试。480x800运行良好,但1280x720遵循800x480文件夹的dp和UI

我不知道为什么这件事会发生在我身上,我也不知道如何解决这个问题。
为什么它不起作用?我应该怎么做?

确保您在drawable xhdpi中提供了相应的drawable

我不知道你创建应用程序的依据是什么。但最好避免为特定的屏幕大小创建布局。。相反,您将给出以下内容:

布局小端口适用于三星galaxy y等设备

为galaxy s2等设备布局普通端口

布局大型端口用于7英寸的nexus 7等设备

布局xlarge端口用于尺寸超过7英寸的设备


如果指定屏幕大小,则无法为不同的屏幕大小支持更多的设备,以下是应用程序中的资源目录列表,该应用程序为不同的屏幕大小提供不同的布局设计,并为小型、中型、高密度和超高密度屏幕提供不同的位图绘制功能

 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

 res/drawable-mdpi/my_icon.png        // bitmap for medium density
 res/drawable-hdpi/my_icon.png        // bitmap for high density
 res/drawable-xhdpi/my_icon.png       // bitmap for extra high density
清单中的代码支持所有DPI

   <supports-screens android:smallScreens="true" 
      android:normalScreens="true" 
      android:largeScreens="true"
      android:xlargeScreens="true"
      android:anyDensity="true" />

U应使用:

res/layout/main_activity.xml           # For handsets (smaller than 480dp available width)
res/layout-sw480dp/main_activity.xml   # For phones (480dp wide and bigger)
res/layout-sw600dp/main_activity.xml   # For 7” tablets (600dp wide and bigger)
res/layout-sw720dp/main_activity.xml   # For 10” tablets (720dp wide and bigger)

伙计们,我知道这一点。我只是想知道如何设置xml的精确分辨率。在我的例子中,800x480 xml的分辨率是1280x720。这就是问题所在。这只是支持各种解决方案的另一种方式。我想以精确的分辨率设置xml。它只是“如何设置布局文件夹名称”:pso拥有特定设备布局的解决方案。只需为分辨率
480x800
创建
,为分辨率
1280x720
创建
values-sw720dp
,无需创建不同的版面分辨率文件夹,只需创建版面即可。它工作得很好。
res/layout/main_activity.xml           # For handsets (smaller than 480dp available width)
res/layout-sw480dp/main_activity.xml   # For phones (480dp wide and bigger)
res/layout-sw600dp/main_activity.xml   # For 7” tablets (600dp wide and bigger)
res/layout-sw720dp/main_activity.xml   # For 10” tablets (720dp wide and bigger)