Android在小屏幕上启动应用程序时,一些元素在屏幕外
我对主要活动的元素布局有意见。我在1280x720屏幕上测试了我的应用程序,所有元素都位于正确的位置,但当我在480x320屏幕上启动它时,我的ImageView掉到了屏幕之外。如何在activity_main.xml布局中修复此问题?以下是我的应用程序元素布局的屏幕截图: activity_main.xml的代码:Android在小屏幕上启动应用程序时,一些元素在屏幕外,android,xml,layout,Android,Xml,Layout,我对主要活动的元素布局有意见。我在1280x720屏幕上测试了我的应用程序,所有元素都位于正确的位置,但当我在480x320屏幕上启动它时,我的ImageView掉到了屏幕之外。如何在activity_main.xml布局中修复此问题?以下是我的应用程序元素布局的屏幕截图: activity_main.xml的代码: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:layo
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:layout="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#fefefe"
>
<TextView android:text="Расчет длины реза натяжных потолков Apply apply-potolki.ru"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="web"
android:linksClickable="true"
android:background="#41d219"
android:gravity="center"
android:textStyle="bold"
android:textColor="#f6fcf4"
android:textColorLink="#336823"
android:textSize="16sp"
/>
<TextView android:text="Введите номер рисунка из каталога Apply, три цифры."
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:background="#fefefe"
android:textColor="#919090"
android:textStyle="bold"
android:textAlignment="center"/>
<EditText
android:id="@+id/catNumber"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:hint="Номер рисунка"
android:textAlignment="center"
android:gravity="center"
android:maxLength="3"/>
<Button
android:id="@+id/go"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Найти"
/>
<TextView android:text=" "
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/anno"
android:gravity="center"
android:background="#fefefe"
android:textColor="#919090"
android:textStyle="bold"/>
<TextView android:text=" "
android:layout_width="wrap_content"
android:id="@+id/sizeText"
android:layout_height="wrap_content"
android:gravity="center"
android:background="#fefefe"
android:textColor="#919090"
android:textStyle="bold" />
<EditText
android:id="@+id/estL"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxLines="1" />
<Button
android:id="@+id/calc"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Рассчитать"/>
<TextView android:text="" android:layout_width="wrap_content"
android:id="@+id/estLtext"
android:layout_height="wrap_content"
android:background="#d9dada"
android:textColor="#191970"
android:textStyle="bold"
android:textSize="16sp" />
<TextView android:text="" android:layout_width="wrap_content"
android:id="@+id/Wtext"
android:layout_height="wrap_content"
android:background="#d9dada"
android:textColor="#191970"
android:textStyle="bold"
android:textSize="16sp" />
<TextView android:text="" android:layout_width="wrap_content"
android:id="@+id/Ltext"
android:layout_height="wrap_content"
android:background="#d9dada"
android:textColor="#FF0000"
android:textStyle="bold"
android:textSize="16sp" />
<TextView android:text="Для расчета стоимости умножьте длину реза на стоимость погонного метра. " android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#fefefe"
android:textColor="#919090"
android:textStyle="bold" />
<Button
android:id="@+id/help"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Справка"/>
<Button
android:id="@+id/exit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Выход"/>
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/photo" />
</LinearLayout>
您希望在较小的屏幕上发生什么?如果要滚动,需要向布局中添加显式的
,很可能是包含
的根元素。是否使用android材质设计库,它可以帮助你保持不同大小的屏幕。我需要在大屏幕上保持相同的外观。你可以使用android:weightSum在不同的屏幕分辨率下保持相似的外观。但如果你有更多的组件,滚动视图是好的。你能更具体地谈谈权重和吗?