Disable soft-keyboard from EditText but still allow copy/paste?

后端 未结 7 1622
误落风尘
误落风尘 2020-11-28 06:39

Hi I\'m making custom dialer so I create my own input pad.

The problem is how do I disable the EditText but still allow cut/copy/paste?

7条回答
  •  一生所求
    2020-11-28 07:07

    try this

     EditText et = ... // your EditText
    
    et.setKeyListener(null) //makes the EditText non-editable so, it acts like a TextView.
    

    No need to subclass. The main difference between this and making your EditText non-focusable, is that the EditText still has its own cursor - you can select text, etc. All it does is suppress the IME from popping up its own soft keyboard.

提交回复
热议问题