editTxt.clearFocus();
//可以解決自動焦點所跳出的鍵盤,之後也可以點選去修改其值
//此句須放在editTxt.setText後..不然還是會取得焦點
為什麼要寫這一篇呢?
因為碰上這問題的時候有人提出下方方法:
使焦點在別的元件 !
layout的布局增加LinearLayout !
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center_vertical">
結果我還是無法取消自動焦點因為有setText在程式碼中,在setText後一句寫了clearFocus()就解決了!
文章標籤
全站熱搜
留言列表

