android 彈出軟鍵盤屬性windowSoftInputMode

1、簡介app

軟件盤設置,會如下面兩種方式影響屏幕的顯示less

一、設置爲「可見」或者「不可見」佈局

stateUnchanged、stateHidden、stateAlwaysHidden、stateVisible、stateAlwaysVisiblespa

二、軟鍵盤的展現方式會影響主界面的佈局,例如能夠是屏幕原有佈局改變尺寸,留給軟鍵盤足夠的空間。orm

也多是,原有佈局不變,軟鍵盤覆蓋在佈局上面。ci

adjustUnspecified、adjustResize、adjustPan、adjustNothingget

設置時,能夠設置單一一個屬性,或者一個state...加上一個adjust...input


2、共有如下十種屬性it

下面分別介紹如下每種屬性的表現io

一、stateUnspecified

The state of the soft keyboard (whether it is hidden or visible) is not specified. The system will choose an appropriate state or rely on the setting in the theme.

This is the default setting for the behavior of the soft keyboard.

這種屬性表示,軟鍵盤顯示或者不顯示沒有設定。系統會x選擇一個合適的狀態,或者根據主題設置的屬性來反應。

這個是軟鍵盤的默認屬性

二、stateUnchanged

The soft keyboard is kept in whatever state it was last in, whether visible or hidden, when the activity comes to the fore.

設置這種屬性後,當activity顯示在最上層的時候、軟鍵盤會保持上一個狀態,不管是可見或者不可見

三、stateHidden

The soft keyboard is hidden when the user chooses the activity — that is, when the user affirmatively navigates forward to the activity, rather than backs into it because of leaving another activity.

設置這一屬性後、當activity是被明確的打開的時候軟鍵盤設置爲隱藏狀態。但若是是從另一個activity返回到當前界面則不會設置。

四、stateAlwaysHidden

The soft keyboard is always hidden when the activity's main window has input focus.

設置這一屬性後、當activity在最上層顯示時,軟鍵盤就會處於隱藏狀態

五、stateVisible

The soft keyboard is visible when that's normally appropriate (when the user is navigating forward to the activity's main window).

設置這一屬性後、當activity是被主動打開的時候軟鍵盤設置爲顯示狀態。

六、stateAlwaysVisible

The soft keyboard is made visible when the user chooses the activity — that is, when the user affirmatively navigates forward to the activity, rather than backs into it because of leaving another activity.

設置這一屬性後、當activity是被明確的打開的時候軟鍵盤設置爲可見狀態。但若是是從另一個activity返回到當前界面則不會設置。

七、adjustUnspecified

It is unspecified whether the activity's main window resizes to make room for the soft keyboard, or whether the contents of the window pan to make the current focus visible on-screen. The system will automatically select one of these modes depending on whether the content of the window has any layout views that can scroll their contents. If there is such a view, the window will be resized, on the assumption that scrolling can make all of the window's contents visible within a smaller area.

This is the default setting for the behavior of the main window.

設置這種屬性表示,activity沒有設定是選擇從新設定尺寸,使軟鍵盤有足夠的空間顯示,或者軟鍵盤覆蓋在原有layout的上面。系統會自動選擇一個模式,這個依賴於界面上是否有一個能夠滾動的view來滾動界面上的內容。若是有一個這樣的view,假定滾動可使全部的內容在一個更小的位置上顯示,則窗口會改變尺寸爲軟鍵盤提供空間。

八、adjustResize

The activity's main window is always resized to make room for the soft keyboard on screen.

界面老是會改變尺寸爲軟鍵盤提供空間顯示。

九、adjustPan

The activity's main window is not resized to make room for the soft keyboard. Rather, the contents of the window are automatically panned so that the current focus is never obscured by the keyboard and users can always see what they are typing. This is generally less desirable than resizing, because the user may need to close the soft keyboard to get at and interact with obscured parts of the window.

主界面不會改變尺寸。窗口會自動的被覆蓋,並且當前的焦點會一直保持不會變,用戶一直處於正在打印狀態。這種屬性不多使用,由於這樣會致使用戶必須關閉軟鍵盤才能操做灰顯部分窗口。

十、adjustNothing

不作任何自適應。

相關文章
相關標籤/搜索