如何在android上处理不同尺寸的屏幕

2023-04-21移动开发问题
2

本文介绍了如何在android上处理不同尺寸的屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

首先,我在模拟器上运行程序.之后,我在许多安卓手机上运行.有些很小,有些显示在旋转侧然后无法旋转回来,并且无法滚动(我没有这样做),有些还可以.

First, I run program on emulator. After that, I run on many android phones. Some are very small, some are show in rotate side then can't rotate back, and can't scroll (I did not do that), some are OK.

我了解可能是不同类型的屏幕造成的,我使用了AbsoluteLayout,但我不知道如何解决这个问题.所以,我需要解决这个问题.任何人都可以帮忙吗?谢谢卡

I understand may caused by different types of screen and I used AbsoluteLayout, but I do not know how to solve that problem.So, I need to resolve this problem. Anyone can help? Thanks ka

我做的示例页面:

  <?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<TextView
    android:id="@+id/usrname"
    android:layout_width="wrap_content"
    android:layout_height="21px"
    android:layout_x="105px"
    android:layout_y="179px"
    android:text="Username :"
    android:textSize="18sp"
    android:textStyle="bold" />

<EditText
    android:id="@+id/usrname_text"
    android:layout_width="161px"
    android:layout_height="wrap_content"
    android:layout_x="74px"
    android:layout_y="206px"
    android:textSize="12sp" />

<TextView
    android:id="@+id/pass"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_x="105px"
    android:layout_y="252px"
    android:text="Password :"
    android:textSize="18sp"
    android:textStyle="bold" >
</TextView>

<EditText
    android:id="@+id/pass_text"
    android:layout_width="163px"
    android:layout_height="wrap_content"
    android:layout_x="73px"
    android:layout_y="279px"
    android:password="true"
    android:textSize="12sp" />

<Button
    android:id="@+id/login"
    android:layout_width="73px"
    android:layout_height="wrap_content"
    android:layout_x="75px"
    android:layout_y="333px"
    android:text="Login" />

<Button
    android:id="@+id/cancle"
    android:layout_width="73px"
    android:layout_height="wrap_content"
    android:layout_x="157px"
    android:layout_y="333px"
    android:text="Cancel" />

</AbsoluteLayout>

这些是来自 Galaxy-S 和模拟器的图片:

These are pictures from Galaxy-S and emulator :

推荐答案

对于这个问题,你在 manifestfile 中使用 Support Screens 标签.更多参考请看下面的链接 支持屏幕

fo rthis problem u use Support screens tag in manifestfile.For further reference see the below link Support screens

这篇关于如何在android上处理不同尺寸的屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

如何抓取 b2Body 并在屏幕上移动它?(cocos2d,box2d,iphone)
How to grab a b2Body and move it around the screen? (cocos2d,box2d,iphone)(如何抓取 b2Body 并在屏幕上移动它?(cocos2d,box2d,iphone))...
2024-08-12 移动开发问题
12

观看 Game Center 屏幕(排行榜、成就)时,如果在 iOS7 中后台运行 cocos2d 2.1 应用程序会崩
Crash if backgrounding cocos2d 2.1 app in iOS7 while watching Game Center screens (leaderboard, achievement)(观看 Game Center 屏幕(排行榜、成就)时,如果在 iOS7 中后台运行 cocos2d 2.1 应用程序会崩溃)...
2024-08-12 移动开发问题
2

cocos2d v3 在应用程序使用期间重新定向屏幕
cocos2d v3 re-orient screen during App use(cocos2d v3 在应用程序使用期间重新定向屏幕)...
2024-08-12 移动开发问题
2

Cocos2d - 设置设备/屏幕方向
Cocos2d - Setting Device/Screen Orientation(Cocos2d - 设置设备/屏幕方向)...
2024-08-12 移动开发问题
19

如何在 COCOS2d Android 中使用 CClistview?
How can I use CClistview in COCOS2d Android?(如何在 COCOS2d Android 中使用 CClistview?)...
2024-08-12 移动开发问题
5

排行榜没有添加到屏幕 cocos2d
Leaderboard doesn#39;t add in the screen cocos2d(排行榜没有添加到屏幕 cocos2d)...
2024-08-12 移动开发问题
6