在講解EditText之前,先介紹一下如何查看android屬性文檔:
1.在SDK api中搜索android
2.在搜索結(jié)果的R.attr中

<EditText
android:id="@+id/edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
以上默認情況下,EditText有焦點,軟件盤不彈出.但是如果EditText被ScrollView包裹,軟件盤會彈出
focusable : Boolean that controls whether a view can take focus.
一個控件是否可以聚焦 ,這個主要應用在非觸摸屏的android應用中
focusableInTouchMode : Boolean that controls whether a view can take focus while in touch mode.
當在觸摸模式下,判斷一個控件是否可以聚焦.
主要用在EditText中,因為軟件盤會為擁有焦點的EditText輸入.如果此值設(shè)置為false,鍵盤是不會彈出的.
windowSoftInputMode :定義了默認的軟件盤輸入狀態(tài)
Defines the default soft input state that this window would like when it is displayed. Corresponds to softInputMode.Must be one or more (separated by '|') of the following constant values.

stateUnspecified: 不特別指定,用系統(tǒng)默認最好的,默認值.
stateUnchanged: 離開軟件盤輸入,不管最后是什么狀態(tài).
stateHidden: 使軟件盤再合適的時候隱藏(當用戶跳向別的頁面) 默認應該就是這個值
stateAlwaysHidden: 軟件盤一直隱藏,暫時看起來與stateHidden沒發(fā)現(xiàn)什么區(qū)別,使用這兩個屬性,再ScrollView存在的情況下,軟件盤不會默認彈出
stateVisible:使軟件盤在合適的時候顯示(使用這個屬性,會顯示軟件盤,但是進入其他頁面再返回默認就不顯示了,只有點擊后才會調(diào)起軟件盤)
stateAlwaysVisable: 當窗口有輸入焦點的時候,軟件盤一直顯示(進入其它頁面,在返回焦點存在,軟件盤還會存在)
adjustUnspecified:窗口的大小/盤調(diào)整沒有被指定,系統(tǒng)將自動選擇調(diào)整大小和 PAN模式,取決于窗口的內(nèi)容是否有任何布局視圖,可以滾動其內(nèi)容。如果有這樣的一個視圖,然后將窗口調(diào)整大小,與假定的可調(diào)整大小的面積為軟件盤空出地方
adjustResize:總是調(diào)整窗口大小:減少窗口區(qū)域去顯示軟件盤:實際效果是鍵盤覆蓋內(nèi)容,如果有ScrollView,就會將其包裹的內(nèi)容向上移動,看到鍵入內(nèi)容.
adjustPan:不會調(diào)整窗口大小,會已焦點位置移動(再EditTextView以上的整體向上移動),方便用戶看到他們的鍵入內(nèi)容.有沒有scrollVIew效果都是一樣的,是整體上移
adjustNothing:不會調(diào)整窗口大小和pan去為軟件盤留位置,窗口不會調(diào)整他. 沒有ScrollView和adjustResize一樣效果,有的話也不會調(diào)整
默認會焦點位置移動,類似adjustPan效果
如果想要默認不顯示軟件盤,并且點擊后輸入內(nèi)容顯示,可以按以下設(shè)置:
<activity
android:name=".MainrActivity"
android:label="@string/title_activity_main"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize"></activity>
下面為一個講解觸摸模式的文章:
http://www.th7.cn/Program/Android/201407/234672.shtml