2010-11-18 23 views

cevap

6

Etkinliğinize android: configChanges = "keyboard | keyboardHidden" eklemeyi denediniz mi?

ör .:

<activity android:name=".MyApp" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden"> 

o ekran klavyesi yanı sıra fiziksel bir birine geçerlidir emin değilim. Ayrıca

Eğer InputMethodManager kullanarak Açık Ekran Klavyesi ile karışıklık, örnek gizlemek için şunu kullanabilirsiniz edebilirsiniz:

InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); 
imm.hideSoftInputFromWindow(mCurretnView.getWindowToken(), 0); 
+0

Yardımlarınız için teşekkürler. Bunu zaten deneyin, ancak çalışmıyor. – Tester

3

olarak this question kullanımda:

EditText edtView=(EditText)findViewById(R.id.editTextConvertValue); 
edtView.setInputType(0); 
1
InputMethodManager inputMethodManager = (InputMethodManager) currentActivity.getSystemService(Context.INPUT_METHOD_SERVICE); 
if (isShow) { 
    if (currentActivity.getCurrentFocus() == null) { 
     inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); 
    } else { 
     inputMethodManager.showSoftInput(currentActivity.getCurrentFocus(), InputMethodManager.SHOW_FORCED);  
    } 

} else { 
    if (currentActivity.getCurrentFocus() == null) { 
     inputMethodManager.toggleSoftInput(InputMethodManager.HIDE_NOT_ALWAYS, 0); 
    } else { 
     inputMethodManager.hideSoftInputFromInputMethod(currentActivity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);  
    } 

} 
0

bu deneyin

@Override 
public boolean dispatchTouchEvent(MotionEvent event) { 
    boolean ret = super.dispatchTouchEvent(event); 
    InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); 
    imm.hideSoftInputFromWindow(mCurretnView.getWindowToken(), 0); 
    return ret; 
} 

veya

editText.setOnTouchListener(new View.OnTouchListener() { 

    @Override 
    public boolean onTouch(View v, MotionEvent event) { 
     InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); 
     imm.hideSoftInputFromWindow(mCurretnView.getWindowToken(), 0); 
     return false; 
    } 
}); 
İlgili konular