2011-10-12 37 views

回答

5

嘗試向EditText屬性添加添加android:capitalize =「characters」。這應該在CAPS中顯示鍵盤。

此外僅供參考,你這是怎麼通過代碼顯示鍵盤:

EditText editText = (EditText) findViewById(R.id.myEdit); 
InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); 
// only will trigger it if no physical keyboard is open 
mgr.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT); 
+0

優秀的感謝! – shawrie

3

您可以通過使用capitalize屬性使鍵盤默認爲全大寫字母:

<EditText 
     android:layout_height="wrap_content" 
     android:layout_width="match_parent" 
     android:capitalize="characters" /> 

請記住,用戶可以簡單地把「大寫鎖定」了。您可以從EditText中檢索到的String上調用.toUpperCase()

相關問題