android - 禁用编辑/文本输入并从 EditText 的剪贴板粘贴

标签 android android-edittext

我们可以在 EditText 中禁用编辑文本,如下所示 https://stackoverflow.com/a/8942552/7767664d

EditText.setFocusable(false)

但是当您长按该 View 并弹出粘贴按钮时,我们仍然可以将一些文本粘贴到该 View 中

enter image description here

最佳答案

否则禁用长按编辑文本:

EditText.setLongClickable(false);

或直接在 xml 中:

android:longClickable="false"

关于android - 禁用编辑/文本输入并从 EditText 的剪贴板粘贴,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61673297/

相关文章:

android - 更改 EditText android 的颜色

java - 从 android 中的 EditText 字段设置对象值

android - 当用户提交数据时显示空字段的 toast

android - 在 Android 中动态编辑 ListView

android - 无法解析 : Could not resolve project:MyProject in Andorid Studio 3. 0 金丝雀 4

java - 使用 EAS 构建构建应用程序时出现 "expo-location:compileReleaseJavaWithJavac"错误

Android Facebook SDK 隐藏登录 View

android - ENOENT : no such file or directory, 打开 'android/app/src/main/assets/index.android.bundle'

android - FragmentStatePagerAdapter fragment 不可见

java - 无法在 2.3.4 上创建多行且没有拼写建议的 EditText