본문 바로가기

프로그래밍/안드로이드

[안드로이드/Android] 안드로이드 키보드 옵션

안드로이드 키보드 옵션


안드로이드를 개발하다보면 키패드 관련하여 여러가지 문제가 발생합니다.


예를 들면 화면이 전환될때 키보드가 자동으로 보여지게 하고싶다. 키보다가 안보이게 하고 싶다 등등. 이런경우 Activity가 활성화 될때 키보드 설정을 어떻게 하는지에 대한 정보 입니다.


<activity android:windowSoftInputMode="stateVisible|adjustResize" . . . >

Values set here (other than "stateUnspecified" and "adjustUnspecified") override values set in the theme.

ValueDescription
"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.

"stateUnchanged"The soft keyboard is kept in whatever state it was last in, whether visible or hidden, when the activity comes to the fore.
"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.
"stateAlwaysHidden"The soft keyboard is always hidden when the activity's main window has input focus.
"stateVisible"The soft keyboard is visible when that's normally appropriate (when the user is navigating forward to the activity's main window).
"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.
"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 currentfocus 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.

"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.

This attribute was introduced in API Level 3.

출처 : http://developer.android.com/guide/topics/manifest/activity-element.html


해당 내용은 위에 있는 것이니 참고 하시구요. 그래도 영어라 좀 거시기 하네요. 대충 짧은 영어 실력으로 아래 몇자 적어 놓았습니다. 참고하시기 바랍니다.


키보드 속성에 따른 값들.

stateUnspecified : 소프트 키보드 상태에 대해 시스템이 선택하거나 테마 설정값을 따른다. 

stateUnchanged : 소프트 키보드는 마지막 상태로 유지한다.

stateHidden : 액티비티를 선택할 때 소프트 키보드는 자동으로 숨겨지도록 한다.

stateAlwaysHidden : 액티비티의 메인 윈도우가 포커스를 가질 때 소프트 키보드는 항상 숨겨지도록 한다.

stateVisible : 액티비티의 메인 윈도우가 앞으로 갈 때 소프트 키보드는 보여지도록 한다.

stateAlwaysVisible : 액티비티가 실행될 때 선택할 때 소프트 키보드는 항상 보여지도록 한다.

adjustUnspecified : 스크롤 할 수 잇는 레이아웃 뷰들이 화면상에 있다면면 윈도우 크기 재조정한다.

adjustResize : 화면에 소프트 키보드 공간을 만들기 위해 메인 윈도우 크기가 항상 재조정 되도록 한다.

adjustPan : 소프트 키보드 공간을 만들기 위해 메인 윈도우 크기가 재조정 되지 않도록 한다.


대충 이렇답니다.

모두 즐프하세요.