在Android中启动活动时如何隐藏softkeyboad? [英] How to hide softkeyboad when activity start in android?
问题描述
我有一个android应用,其中一个布局包含Linearlayout
,ScrollView
,TextView
,EditView
和Button
.当我从一个活动调用到另一个活动时,并设置我已经描述的layout
.
我想知道何时默认选择EditView
进行活动调用.并打开softkeyboard
.我不想在活动开始时打开该键盘.但我想在EditView
的触摸事件上打开该softkeyboard
.
我该怎么做?
在您的AndroidManifest.xml
中:
<activity android:name="com.your.package.ActivityName"
android:windowSoftInputMode="stateHidden" />
有关windowSoftInputMode
的更多详细信息,可以在此处找到.. >
当用户输入新的活动"时,此设置将隐藏软键盘(即使EditText控件获得了焦点).仅当用户单击编辑框控件时,才会显示软键盘.
I have android app in which one layout contains Linearlayout
, ScrollView
, TextView
, EditView
and Button
. when I call from one activity to other this activity call and set layout
which I have describe.
I would like to know when activity call there is by default EditView
selected. and open the softkeyboard
. I don't want to open that keyboard when activity start. but I want to open that softkeyboard
on touch event of EditView
.
How can I do that?
In your AndroidManifest.xml
:
<activity android:name="com.your.package.ActivityName"
android:windowSoftInputMode="stateHidden" />
More details about windowSoftInputMode
can be found here.
This setting will hide soft keyboard when user enters new Activity (even if EditText control gains the focus). Soft keyboard will be shown only when user clicks the edit box control.
这篇关于在Android中启动活动时如何隐藏softkeyboad?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!