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.
我有Android应用程序,其中一个布局包含Linearlayout,ScrollView,TextView,EditView和Button。当我从一个活动呼叫到其他活动时调用并设置我描述的布局。
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
.
我想知道默认EditView选择时的活动调用。并打开软键盘。我不想在活动开始时打开那个键盘。但我想在EditView的触摸事件上打开该软键盘。
How can I do that?
我怎样才能做到这一点?
2 个解决方案
#1
127
In your AndroidManifest.xml
:
在AndroidManifest.xml中:
<activity android:name="com.your.package.ActivityName"
android:windowSoftInputMode="stateHidden" />
More details about windowSoftInputMode
can be found here.
有关windowSoftInputMode的更多详细信息,请访问此处。
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.
当用户输入新活动时,此设置将隐藏软键盘(即使EditText控件获得焦点)。仅当用户单击编辑框控件时,才会显示软键盘。
#2
1
You can hide keyboard by add two lines to the parent view of editText.
您可以通过在editText的父视图中添加两行来隐藏键盘。
android:focusable="true"
android:focusableInTouchMode="true"
#1
127
In your AndroidManifest.xml
:
在AndroidManifest.xml中:
<activity android:name="com.your.package.ActivityName"
android:windowSoftInputMode="stateHidden" />
More details about windowSoftInputMode
can be found here.
有关windowSoftInputMode的更多详细信息,请访问此处。
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.
当用户输入新活动时,此设置将隐藏软键盘(即使EditText控件获得焦点)。仅当用户单击编辑框控件时,才会显示软键盘。
#2
1
You can hide keyboard by add two lines to the parent view of editText.
您可以通过在editText的父视图中添加两行来隐藏键盘。
android:focusable="true"
android:focusableInTouchMode="true"