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

标签 android android-emulator screen

首先,我在模拟器上运行程序。之后,我在许多安卓手机上运行。有些很小,有些显示在旋转侧然后不能旋转回来,也不能滚动(我没有那样做),有些还可以。

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

我做的示例页面:

  <?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 和模拟器的图片:

enter image description here enter image description here

最佳答案

对于这个问题,您可以在 list 文件中使用 Support screens 标签。有关进一步的引用,请参见以下链接 Support screens

关于android - 如何在android上处理不同尺寸的屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4848884/

相关文章:

sql - 在android中查询数据库

android - 移植Android应用程序网站? (编辑: To any other platform?)

Android Studio 看不到 AVD

java - 更新工作——如何通过在 android 的触摸屏上滑动手指来测试智能手机屏幕?

c# 屏幕边界不正确

java - 如何从 SQLite 数据库填充的 ListView 中删除选定的行

php - 需要什么以及如何将 TTL 指纹模块连接到 Raspberry pi 3

android - 带有 countDownTimer 的 onFinish 方法问题的 listView

Android Market 过滤器应用程序 - 电话?

android - tablayout+view pager中的Tab Title 添加CoordinatorLayout后Android 5.0及以上不显示