0

每次進入活動時,鍵盤佈局都會移動。我希望字段保持在鍵盤下方,並使用滾動條。 我認爲這可能與操作欄有關。如何避免鍵盤移動我的佈局

見赫拉打印screen

我沒有成功使用android:windowSoftInputMode="adjustPan|adjustResize"

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:gravity="center_horizontal" 
    android:orientation="vertical" 
    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.bruno.gpmap.manage.Register"> 

    <ScrollView 
     android:id="@+id/cad_register_form" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

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

      <android.support.design.widget.TextInputLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"> 

       <AutoCompleteTextView 
        android:id="@+id/email" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="@string/prompt_email" 
        android:inputType="textEmailAddress" 
        android:maxLines="1" 
        android:singleLine="true" /> 

      </android.support.design.widget.TextInputLayout> 

      <android.support.design.widget.TextInputLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"> 

       <AutoCompleteTextView 
        android:id="@+id/name" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="@string/name" 
        android:inputType="textPersonName" 
        android:maxLines="1" 
        android:singleLine="true" /> 

      </android.support.design.widget.TextInputLayout> 

      <android.support.design.widget.TextInputLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"> 

       <EditText 
        android:id="@+id/password" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="@string/prompt_password" 
        android:imeActionId="@+id/login" 
        android:imeActionLabel="@string/action_sign_in_short" 
        android:imeOptions="actionUnspecified" 
        android:inputType="textPassword" 
        android:maxLines="1" 
        android:singleLine="true" /> 

      </android.support.design.widget.TextInputLayout> 

      <Button 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:text="@string/pick_date" 
       android:onClick="showDatePickerDialog" /> 
      <Spinner 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:id="@+id/gender" 
       android:layout_gravity="center_horizontal" 
       android:entries="@array/gender"/> 

      <Button 
       android:id="@+id/email_sign_in_button" 
       style="?android:textAppearanceSmall" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="16dp" 
       android:text="@string/action_sign_in" 
       android:textStyle="bold" /> 

     </LinearLayout> 
    </ScrollView> 
</RelativeLayout> 
+1

只用機器人:windowSoftInputMode = 「adjustPan」 – Pavya

回答

0

將android:windowSoftInputMode =「adjustPan」添加到您的Manifest文件中的特定活動。

<activity 
    android:windowSoftInputMode="adjustPan"> 
</activity> 
+0

我mencioned,我已經使用過這一點。 – brunocortes06

0

他們不工作,因爲您正在使用ScrollView

使用android:isScrollContainer="false"ScrollView

+0

沒有工作,我認爲有一些與動作欄 – brunocortes06

+0

它也需要'android:windowSoftInputMode =「adjustResize」'爲您的清單中的活動 –

相關問題