for android ,如何使EditText不在active onCreate時就逕自駐焦並出現鍵盤?
在activity create後就逕自駐焦並出現鍵盤,好像很貼心,
事實上一點也不,需要時點到再出現鍵盤比較好吧
怎麼設定?
在EditText外層的linear layout中加入一行設定「android:focusableInTouchMode="true"」即可,不必寫什麼code了
來源在此
大家努力吧
以為自己什麼都會,事實上是什麼都只會一點點的雜工罷了
在activity create後就逕自駐焦並出現鍵盤,好像很貼心,
1 個意見:
還有個更直接的方式
找出那個進去就被focus的EditText物件
直接下clearFocus指令就可以了,如....
=====in onCreate function======
.....
.....
EditText email=(EditText)findViewById(R.id.txtEmail);
email.clearFocus();
...
...
=============================
張貼留言
訂閱 張貼留言 [Atom]
<< 首頁