2017-03-26 3 views
0

Ich verwende android.support.design.widget.TextInputLayout in meiner regsister.xml . Aber wenn die Seite geöffnet wird, geht der erste Editiertext nach oben, aber die Tastatur erscheint nicht. Was ich will, ist ein Hinweis, der nur dann nach oben geht, wenn wir in den Editiertext klicken.Bewegen Sie den Hinweis nicht nach oben, bis die Tastatur erscheint - android.support.design.widget.TextInputLayout

this is image of my page when it opens. `

und meine XML-Datei ist unter

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:theme="@style/AppTheme.AppBarOverlay"> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:background="?attr/colorPrimary" 
      app:popupTheme="@style/AppTheme.PopupOverlay" /> 
    </android.support.design.widget.AppBarLayout> 

    <LinearLayout 
     android:id="@+id/linear_details" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_marginLeft="10dp" 
     android:layout_marginRight="10dp" 
     android:layout_marginTop="?attr/actionBarSize" 
     android:orientation="vertical"> 

     <android.support.design.widget.TextInputLayout 
      android:id="@+id/input_layout_name" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="10dp" 
      android:theme="@style/TextLabel"> 

      <EditText 
       android:id="@+id/input_name" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:hint="Name" 
       android:singleLine="true" /> 
     </android.support.design.widget.TextInputLayout> 

     <android.support.design.widget.TextInputLayout 
      android:id="@+id/input_layout_age" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="10dp" 
      android:theme="@style/TextLabel"> 

      <EditText 
       android:id="@+id/input_age" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:hint="Age" 
       android:inputType="number" /> 
     </android.support.design.widget.TextInputLayout> 

     <android.support.design.widget.TextInputLayout 
      android:id="@+id/input_layout_phone_number" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="10dp" 
      android:theme="@style/TextLabel"> 

      <EditText 
       android:id="@+id/input_phone_number" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:hint="Phone Number" 
       android:inputType="number" /> 
     </android.support.design.widget.TextInputLayout> 

     <Spinner 
      android:id="@+id/spinner_gender" 
      style="@style/Widget.AppCompat.Spinner.Underlined" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="10dp" 
      android:theme="@style/ThemeSpinner"> 

     </Spinner> 

     <Spinner 
      android:id="@+id/spinner_blood_group" 
      style="@style/Widget.AppCompat.Spinner.Underlined" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="10dp" 
      android:theme="@style/ThemeSpinner"> 

     </Spinner> 

     <android.support.design.widget.TextInputLayout 
      android:id="@+id/input_layout_city" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="10dp" 
      android:theme="@style/TextLabel"> 

      <EditText 
       android:id="@+id/input_city" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:hint="City" 
       android:inputType="text" 
       android:singleLine="true" /> 
     </android.support.design.widget.TextInputLayout> 

     <android.support.design.widget.TextInputLayout 
      android:id="@+id/input_layout_area" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="10dp" 
      android:theme="@style/TextLabel"> 

      <EditText 
       android:id="@+id/input_area" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:hint="Area" 
       android:inputType="text" 
       android:singleLine="true" /> 
     </android.support.design.widget.TextInputLayout> 
    </LinearLayout> 

    <Button 
     android:id="@+id/submit" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/linear_details" 
     android:layout_marginBottom="10dp"`` 
     android:layout_marginLeft="10dp" 
     android:layout_marginRight="10dp" 
     android:background="@color/colorPrimary" 
     android:text="Submit" 
     android:textColor="@android:color/white" /> 
</RelativeLayout> 
+0

Wenn Sie explizit auf Edittext klicken, erscheint die Tastatur? Haben Sie android: windowSoftInputMode = "stateHidden" im Manifest angewendet? – tahsinRupam

+0

yes..keyboard erscheint, wenn ich explizit auf Text bearbeiten klicke. Und ich habe nicht android: windowSoftInputMode = "stateHidden" dieses. – Nan

+0

Überprüfen Sie meine Antwort. – tahsinRupam

Antwort

1

android:focusableInTouchMode="true" zu Ihren Eltern Layout-Set:

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:focusableInTouchMode="true" > 

Hoffnung, das hilft.

+1

fertig..danke :) – Nan

+0

Gern geschehen :) – tahsinRupam

Verwandte Themen