Disable keyboard on EditText
Posted
by
Ferox
on Stack Overflow
See other posts from Stack Overflow
or by Ferox
Published on 2012-05-17T13:25:18Z
Indexed on
2012/09/13
9:38 UTC
Read the original article
Hit count: 311
I'm doing a calculator.
So I made my own Buttons
with numbers and functions.
The expression that has to be calculated, is in an EditText
, because I want users can add numbers or functions also in the middle of the expression, so with the EditText
I have the cursor
. But I want to disable the Keyboard
when users click on the EditText
.
I found this example that it's ok for Android 2.3
, but with ICS
disable the Keyboard
and also the cursor.
public class NoImeEditText extends EditText {
public NoImeEditText(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean onCheckIsTextEditor() {
return false;
}
}
And then I use this NoImeEditText
in my XML
file
<com.my.package.NoImeEditText
android:id="@+id/etMy"
....
/>
How I can make compatible this EditText with ICS??? Thanks.
© Stack Overflow or respective owner