2017-03-26 6 views
0

私はregsister.xmlにandroid.support.design.widget.TextInputLayoutを使用しています 。しかし、ページが最初に開くとき、edittextヒントは上向きですが、キーボードは表示されません。私が望むのはヒントです。キーボードが表示されるまでヒントを上に移動しないでください - android.support.design.widget.TextInputLayout

this is image of my page when it opens. `

と私のxmlファイル、あなたの親のレイアウトに

<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

edittextを明示的にクリックすると、キーボードが表示されますか? android:windowSoftInputMode = "stateHidden"をマニフェストに適用しましたか? – tahsinRupam

+0

はい..キーボードを明示的にクリックしてtext.andをクリックしたときにキーボードが表示され、アンドロイドを適用しませんでした:windowSoftInputMode = "stateHidden" – Nan

+0

私の答えplsをチェックしてください。 – tahsinRupam

答えて

1

以下に設定android:focusableInTouchMode="true"です:

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

・ホープ、このことができます。

+1

done ..thank u :) – Nan

+0

あなたは大歓迎です:) – tahsinRupam

関連する問題