How to handle different sizes of screen on android(如何在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上处理不同尺寸的屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在android上处理不同尺寸的屏幕


基础教程推荐
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01