Android横向模式切断我最后的编辑文本

Android横向模式切断我最后的编辑文本,android,android-layout,Android,Android Layout,我的申请有问题 我的布局包含: 图像视图 钮扣 四编辑文本 当我在横向模式下更改模拟器时,ScrollView将转到第三个EditText。最后一个编辑文本不会以横向模式显示 My layout.xml <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match

我的申请有问题

我的布局包含:

  • 图像视图
  • 钮扣
  • 四编辑文本
当我在横向模式下更改模拟器时,ScrollView将转到第三个EditText。最后一个编辑文本不会以横向模式显示

My layout.xml

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

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="60dp"
    android:orientation="vertical">

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="235dp">

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:id="@+id/formulario_foto"
            android:background="#00A8EC"
            android:src="@drawable/person"/>

        <Button
            android:layout_width="56dp"
            android:layout_height="56dp"
            android:id="@+id/formulario_foto_button"
            android:layout_alignParentBottom='true'
            android:layout_alignParentRight="true"
            android:layout_marginBottom="5dp"
            android:layout_marginRight="20dp"
            android:background="@drawable/formulario_foto_button"
            android:elevation="5dp"
            android:gravity="center"
            android:textColor="#FFFFFF"
            android:textSize="20sp"/>

    </RelativeLayout>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:hint="Nome"
        android:id="@+id/editTextNome" />

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:ems="10"
        android:hint="E-mail"
        android:id="@+id/editTextEmail" />

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:hint="Endereço"
        android:id="@+id/editTextEndereco" />

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:inputType="phone"
        android:ems="10"
        android:hint="Telefone"
        android:id="@+id/editTextTelefone" />

    </LinearLayout>
</ScrollView>


将线性布局高度更改为包裹内容

将线性布局高度更改为包裹内容

看起来
滚动视图
不考虑其子级的边距。这一行为在本书中已被注意到

解决方法是将
线性布局
包装在
框架布局
中,即

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="60dp"
        android:orientation="vertical">
    ...
    </LinearLayout>
</FrameLayout>
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingTop="60dp"
    android:orientation="vertical">
...
</LinearLayout>

看起来
ScrollView
不尊重其子级的边距。这一行为在本书中已被注意到

解决方法是将
线性布局
包装在
框架布局
中,即

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="60dp"
        android:orientation="vertical">
    ...
    </LinearLayout>
</FrameLayout>
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingTop="60dp"
    android:orientation="vertical">
...
</LinearLayout>

您已定义相对布局高度235 dp,但其子级的组合高度为256 dp??您已定义相对布局高度235 dp,但其子级的组合高度为256 dp??我进行了更改,但相同的问题仍然存在=[我进行了更改,但相同的问题仍然存在=[