当我以横向模式查看应用时...它显示如下。注册按钮正在切割。我刚开始学习Android。
我的xml代码在
下面<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_register"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.bugmanagement.pankaj.androidexample.Activities.UserManagement.Auth.RegisterActivity">
<android.support.design.widget.TextInputLayout
android:id="@+id/lblEmailAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/txtEmailAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_email"
android:inputType="textEmailAddress" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/lblUserName"
android:layout_width="match_parent"
android:layout_below="@id/lblEmailAddress"
android:layout_height="wrap_content">
<EditText
android:id="@+id/txtUserName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_email"
android:inputType="text" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/lblPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/lblUserName">
<EditText
android:id="@+id/txtPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="45dp"
android:hint="@string/hint_password"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/lblPasswordConfirmation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/lblPassword">
<EditText
android:id="@+id/txtPasswordConfirmation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="45dp"
android:hint="@string/hint_passwordConfirmation"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="@+id/btnRegister"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/lblPasswordConfirmation"
android:text="Register" />
<Button
android:id="@+id/btnNavigateToLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/btnRegister"
android:text="Login" />
<ProgressBar
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/btnNavigateToLogin"
android:layout_centerHorizontal="true"
android:id="@+id/progressBarRegister" />
</RelativeLayout>
我错过了什么吗?
答案 0 :(得分:2)
Try wrapping your layout in a ScrollView
这将使您的布局可滚动
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_register"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.bugmanagement.pankaj.androidexample.Activities.UserManagement.Auth.RegisterActivity">
<android.support.design.widget.TextInputLayout
android:id="@+id/lblEmailAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/txtEmailAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_email"
android:inputType="textEmailAddress" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/lblUserName"
android:layout_width="match_parent"
android:layout_below="@id/lblEmailAddress"
android:layout_height="wrap_content">
<EditText
android:id="@+id/txtUserName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_email"
android:inputType="text" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/lblPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/lblUserName">
<EditText
android:id="@+id/txtPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="45dp"
android:hint="@string/hint_password"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/lblPasswordConfirmation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/lblPassword">
<EditText
android:id="@+id/txtPasswordConfirmation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="45dp"
android:hint="@string/hint_passwordConfirmation"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="@+id/btnRegister"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/lblPasswordConfirmation"
android:text="Register" />
<Button
android:id="@+id/btnNavigateToLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/btnRegister"
android:text="Login" />
<ProgressBar
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/btnNavigateToLogin"
android:layout_centerHorizontal="true"
android:id="@+id/progressBarRegister" />
</RelativeLayout>
</ScrollView>