0

我有一個表格供用戶填寫,表單的最後一項是支持多行的EditText。EditText強制提交按鈕在屏幕上

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    tools:context=".ContactUs.ContactUs"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:focusable="true" 
     android:focusableInTouchMode="true" 
     android:orientation="vertical" 
     android:paddingBottom="@dimen/baseline_margin_unit" 
     android:paddingLeft="@dimen/baseline_margin_unit" 
     android:paddingRight="@dimen/baseline_margin_unit"> 

     <LinearLayout 
      android:id="@+id/contact_details" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_horizontal" 
      android:orientation="vertical"> 

     </LinearLayout> 

     <com.rengwuxian.materialedittext.MaterialEditText 
      android:id="@+id/name" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:hint="@string/contact_us_name" 
      android:inputType="textPersonName" 
      app:floatingLabel="normal" 
      app:floatingLabelText="@string/contact_us_name" /> 

     <com.rengwuxian.materialedittext.MaterialEditText 
      android:id="@+id/phone" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:hint="@string/contact_us_phone_number" 
      android:inputType="phone" 
      app:floatingLabel="normal" 
      app:floatingLabelText="@string/contact_us_phone_number" /> 

     <com.rengwuxian.materialedittext.MaterialEditText 
      android:id="@+id/email" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:hint="@string/contact_us_email" 
      android:inputType="textEmailAddress" 
      app:floatingLabel="normal" 
      app:floatingLabelText="@string/contact_us_email" /> 

     <com.rengwuxian.materialedittext.MaterialEditText 
      android:id="@+id/message" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:hint="@string/contact_us_message" 
      app:floatingLabel="normal" 
      app:floatingLabelText="@string/contact_us_message" /> 

     <Button 
      android:id="@+id/submit_email" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="right" 
      android:text="@string/contact_us_send" /> 

    </LinearLayout> 
</ScrollView> 

當用戶關注EditText時,它將視圖向上滾動以容納屏幕上的鍵盤。我想要做的是強制自動滾動(在選擇並添加新行)以保持提交按鈕在任何時候都可以看到。

回答