您的位置:首页 > 移动开发

解决刚进入APP时搜索框获取焦点,软键盘自动弹出的问题

2016-11-07 16:45 537 查看
APP运行进入主界面,搜索框获取焦点,软键盘自动弹出,这是一个很不好的用户体验。

根据我遇到的情况,记录下解决方法。

在控件外层的布局中:

  android:focusable="true"

            android:focusableInTouchMode="true"

在EditText中:

android:imeOptions="actionSearch"

                android:singleLine="true"

如: <RelativeLayout

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:focusable="true"

            android:focusableInTouchMode="true"

            >

            <EditText

                android:layout_width="match_parent"

                android:layout_height="40dp"

                android:hint="搜索"

                android:imeOptions="actionSearch"

                android:singleLine="true"

                />

        </RelativeLayout>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐