您的位置:首页 > 其它

解决进入Activity默认焦点选中第一个EditText,并弹出软键盘。

2017-11-22 10:13 671 查看
需求如题,直接选中一个文本框并弹出软键盘并不友好。

解决方法:在xml的根容器中添加两个配置即可:将
focusable
focusableInTouchMode
都设为
true
即可。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:focusable="true"
android:focusableInTouchMode="true">

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