在Android中启动活动时如何隐藏softkeyboad? [英] How to hide softkeyboad when activity start in android?

查看:89
本文介绍了在Android中启动活动时如何隐藏softkeyboad?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个android应用,其中一个布局包含LinearlayoutScrollViewTextViewEditViewButton.当我从一个活动调用到另一个活动时,并设置我已经描述的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆