如何设置我的 .apk 文件在 Android 中的不同屏幕分辨率上运行?

发布于 2024-10-08 06:13:53 字数 427 浏览 0 评论 0原文

我的应用程序使用的是“WVGA800”。我尝试在不同分辨率的屏幕上运行它。它并没有完全符合该决议。 我阅读并实施了此链接中的问题。 http://developer.android.com/guide/practices/screens_support.html 但还是没有结果。如果有人有完美的解决方案请告诉我。 主要问题是我正在修复高度和高度。图像宽度、文本大小等。当显示这些时 到“WVGA800”的屏幕。但是当我在“HVGA”、“QVGA”上测试它们时,问题就出现了。 我想通过在运行时获取屏幕分辨率来避免“if else”条件。如果有人对此有任何解决方案......请告诉我。提前致谢。 我还想知道什么时候会有具有新屏幕分辨率的新设备?

I am using a "WVGA800" for my app. I try to run it on different resolution screens. It it is not perfectly scratching in that resolution .
I read and implement issues form this link.
http://developer.android.com/guide/practices/screens_support.html
But still not result. Please let me know if any one hase a perfect solution.
Main issue are that I am fixing hight & width of Image, textsize etc. When these are displayed
to screen of "WVGA800". But when I test them on "HVGA", "QVGA" then problem arise.
I want to avoid the "if else" conditions by getting the screen resolution at Runtime. If any one hase any solution for this...let me know. Thanks in advance.
I am also wondring when there will be new devices with new screen resolutions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

时光是把杀猪刀 2024-10-15 06:13:53

请参阅,可能对您有帮助。

See this, may be its helpful for you.

别再吹冷风 2024-10-15 06:13:53

主要问题是我正在修复 hight &图像的宽度、文本大小等

不要这样做。

Main issue are that I am fixing hight & width of Image, textsize etc

Don't do that.

洛阳烟雨空心柳 2024-10-15 06:13:53
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.your_company.package_name"
  android:versionCode="1"
  android:versionName="1.0">
<supports-screens
  android:smallScreens="true"
  android:normalScreens="true"
  android:largeScreens="true"
  android:anyDensity="true"/>
.....
</manifest> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.your_company.package_name"
  android:versionCode="1"
  android:versionName="1.0">
<supports-screens
  android:smallScreens="true"
  android:normalScreens="true"
  android:largeScreens="true"
  android:anyDensity="true"/>
.....
</manifest> 
天荒地未老 2024-10-15 06:13:53

您必须将以下代码添加到您的清单中:-

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

并且您必须使用不同的屏幕制作不同的不同布局文件夹:-

layout-small-ldpi (240x320)  
layout-small-land-ldpi (320x240)

layout-ldpi  (240 x 400 )
layout-land-ldpi  (400 x 240 )

layout-mdpi (320 x 480 )
layout-land-mdpi (480 x 320 )

layout-large-mdpi (320 x 480 )
layout-large-land-mdpi (480 x 320)

layout-large  (600 x 1024)
layout-large-land  (1024 x 600)

layout-hdpi (480 x 800)
layout-land-hdpi (800 x 480)

layout-xlarge (800 x 1280)
layout-xlarge-land (1280 x 800)

You have to add below code into your manifest:-

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

and you must have to make different different layout folder with different screen:-

layout-small-ldpi (240x320)  
layout-small-land-ldpi (320x240)

layout-ldpi  (240 x 400 )
layout-land-ldpi  (400 x 240 )

layout-mdpi (320 x 480 )
layout-land-mdpi (480 x 320 )

layout-large-mdpi (320 x 480 )
layout-large-land-mdpi (480 x 320)

layout-large  (600 x 1024)
layout-large-land  (1024 x 600)

layout-hdpi (480 x 800)
layout-land-hdpi (800 x 480)

layout-xlarge (800 x 1280)
layout-xlarge-land (1280 x 800)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文