应用程序不适应屏幕
我在layout-normal中创建了一个应用程序。当我在5英寸的屏幕上测试时,我意识到它并不适合,我重新布局布局 - 大,我增加了各种密度,我在声明中做了声明并在手机中测试,但仍然不适合。?然而,在它适合模拟器什么可能会发生应用程序不适应屏幕
附的布局之一:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ScrollView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<RelativeLayout
android:id="@+id/RelativeLayout1"
android:layout_width="480dp"
android:layout_height="728dp"
android:background="@drawable/note2" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="73dp"
android:text="Productos:"
android:textAppearance="?android:attr/textAppearanceLarge" />
<Button
android:id="@+id/button1"
android:layout_width="100dp"
android:layout_height="60dp"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/textView1"
android:layout_marginRight="28dp"
android:background="@drawable/escoba"
android:onClick="VaciarLista"
android:text="Vaciar" />
<ListView
android:id="@+id/listView_1"
android:layout_width="430dp"
android:layout_height="600dp"
android:layout_below="@+id/button1"
android:layout_centerHorizontal="true"
>
</ListView>
</RelativeLayout>
</ScrollView>
而且清单的一部分:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.proyecto"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="19" />
<supports-screens
android:resizeable="true"
android:smallScreens="false"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="false"
android:anyDensity="true"/>
<application ...
也许你指定一个固定的大小在布局中?如果您至少可以向我们提供布局,将会非常有用ENT。
这是正确的答案,你不应该在*组布局中使用固定的'width'和'height' – 2015-02-09 08:15:09
尝试使用wrap_content进行放置,但不适用于屏幕,给我一个白色的边框 – Marta 2015-02-09 08:20:49
使用match_parent作为宽度,而且在ListView中放置一个ListView并不是一个好习惯,你可以把一个标题放到你的ListView上 – 2015-02-09 08:22:21
layout-large用于平板电脑,afaik。因此它对5英寸手机没有任何影响,你不能在这里发布你的布局代码吗 – 2015-02-09 08:00:56
试过match_parent而不是wrap_content?因为发生在你身上的是将480dp和728dp等固定尺寸分配给主布局的正常结果在你的活动布局 – 2015-02-09 09:08:56
是的,我已经试过但仍然不工作 – Marta 2015-02-09 09:25:34