当前位置:首页 » 安卓系统 » android长按复制

android长按复制

发布时间: 2024-10-27 14:03:32

A. Android的EditText长按只显示上面的复制粘贴菜单,不要弹出下面的输入法键盘怎么做

4.0以上的API禁止EditText弹出键盘需要这样写:

4.0的是setShowSoftInputOnFocus,4.2的是setSoftInputOnFocus。

java">EditTexteditText;
//editText的实例化我不写了
InputMethodManagerimm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(e1.getWindowToken(),0);
try{
Class<EditText>cls=EditText.class;
setSoftInputShownOnFocus=cls.getMethod("setShowSoftInputOnFocus",boolean.class);
setSoftInputShownOnFocus.setAccessible(true);
setSoftInputShownOnFocus.invoke(editText,false);
}catch(Exceptione){
e.printStackTrace();
}

并且还要在配置文件里面加上android:windowSoftInputMode="stateHidden"

4.0以下的可用editText.setInputType(InputType.TYPE_NULL);

或者直接在XML进行属性设置。

如果对4.0以上系统的操作这句代码,EditText将会没有光标。

热点内容
怎么样能让服务器悬空 发布:2024-10-27 16:28:25 浏览:979
eds服务器是什么 发布:2024-10-27 16:02:39 浏览:1
mysqlpython连接池 发布:2024-10-27 16:02:35 浏览:180
四川阿里云服务器选哪里 发布:2024-10-27 15:55:18 浏览:700
soaphp 发布:2024-10-27 15:54:21 浏览:218
我的世界暑期红石服务器 发布:2024-10-27 15:54:11 浏览:958
台湾ip代理服务器云服务器 发布:2024-10-27 15:53:21 浏览:645
app编译原理 发布:2024-10-27 15:52:20 浏览:105
qq留言的访问记录 发布:2024-10-27 15:49:41 浏览:877
androidtextview点击事件 发布:2024-10-27 15:42:24 浏览:692