2016-08-29 6 views
0

私のキーボードが私のEditTextに表示されるのを苦労しています。 EditTextを初めてクリックすると、キーボードが表示され、正常に動作します。キーボードが表示されませんonClick EditText

キーボードを隠して同じEditTextをもう一度クリックするために戻るボタンを押すと、キーボードが表示されません。私は本当に助けに感謝します。関連するコードは以下の通りです。

NewEntry:

assessor.setOnEditorActionListener(new TextView.OnEditorActionListener() { 
       @Override 
       public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { 


        if (actionId == EditorInfo.IME_ACTION_DONE) { 
         InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); 
         inputMethodManager.hideSoftInputFromWindow(context.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); 

         EditText email = (EditText) context.findViewById(R.id.email); 

         email.requestFocus(); 

         return true; 
        } 

レイアウト:

<EditText 
    android:layout_height="72dp" 
    android:layout_width="wrap_content" 
    android:id="@+id/assessor" 
    android:textColor="@color/black" 
    android:textSize="20dp" 
    android:background="@android:color/transparent" 
    android:fontFamily="sans-serif-light" 
    android:layout_marginLeft="72dp" 
    android:layout_marginRight="16dp" 
    android:hint="Assessor" 
    android:inputType="text" 
    android:imeOptions="actionNext" 
    android:ems="10" 
    android:windowSoftInputMode="adjustPan" 
    /> 

答えて

0

これを試してみてください:

はのEditTextのためonClickListenerを設定し、それがクリックされたとき、それは

EditTextName.setOnClickListener(new OnClickListener() { 
@Override 
public void onClick(View view) { 

editText.requestFocus(); 

} 
を集中要求します

これがあなたの問題を解決するかどうかは分かりませんが、少なくとも私は試しました:P

+0

それはうまくいきませんでした。試していただきありがとうございます! :) –

+0

私はそれがと関係があると思います。 HIDE_NOT_ALWAYS。なぜあなたはその部分が必要ですか? –

関連する問題