繁体   English   中英

如何使我的应用程序支持所有设备的分辨率

[英]how to make my application support for all devices resolution

我开发了一个在模拟器和三星设备上都能很好运行的应用程序。 但是,当我在我的android SDK中下载的Motorola模拟器中对其进行测试时,它不起作用。 谁能帮我解决支持多个设备的问题?

您可以在AndroidManifest.xml中添加以下代码以支持不同的屏幕。

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

请检查此以获取更多详细信息, http://developer.android.com/guide/topics/manifest/supports-screens-element.html希望对您有所帮助。

目前还不清楚您的问题是什么,但是如果分辨率改变,布局问题通常会很多。 其中之一是布局xml中使用的单位:

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:textSize="13px"
                android:paddingLeft="10px" />

在这种情况下,例如textSize以像素为单位,取决于屏幕的DPI,它可以更大或更小。 您可以更改此指定其他度量单位,例如点:

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:textSize="13pt"
                android:paddingLeft="10pt" />

在您的问题中提供更多细节。

我很大程度上取决于您的问题所在,但是如果问题是您的应用无法安装,请尝试将其添加到AndroidManifest中

<supports-screens android:anyDensity="true" />

对于不同的分辨率,SDK 1.5不支持可绘制的子文件夹( /hdpi/mdpi/sdpi )。 如果需要您的应用程序在所有SDK上都可以运行,则应将所有可绘制对象放在/drawable文件夹(而不是其子文件夹)中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM