设置EditText光标不聚焦,,软件盘不自动弹出

来源:互联网 发布:自学机器人编程入门 编辑:程序博客网 时间:2024/04/30 14:13

界面有EditText控件时候,一打开界面,往往会自动弹出软键盘,自动聚焦,想取消这种情况的发生,可以再上一级的父容器添加两个属性

android:focusable="true"android:focusableInTouchMode="true"

注意  在EditText控件中添加没有效果

另外一种解决办法是在onCreate()中添加

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

网上也有别的解决办法

1.在Edittext中加入以下属性

android:cursorVisible="true"android:textCursorDrawable="@null"
我试过这个不太好使,,可以借鉴试试。

阅读全文
1 0
原创粉丝点击