最佳答案
我在做计算器。
So I made my own Buttons with numbers and functions.
必须计算的表达式在 EditText中,因为我希望用户也可以在表达式的中间添加数字或函数,所以在 EditText中我有 cursor。但我想禁用的 Keyboard时,用户点击的 EditText。
我发现这个例子,这是确定的 Android 2.3,但与 ICS禁用的 Keyboard和光标。
public class NoImeEditText extends EditText {
public NoImeEditText(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean onCheckIsTextEditor() {
return false;
}
}
然后在我的 XML文件中使用这个 NoImeEditText
<com.my.package.NoImeEditText
android:id="@+id/etMy"
....
/>
How I can make compatible this EditText with ICS??? 谢谢。