I am working on a dialog at Android with a few EditText
s.
I\'ve put this line at the onCreate()
in order to disable the soft keyboard:
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(edSearch.getWindowToken(), 0);
Try this out..
edittext.setInputType(InputType.TYPE_NULL);
if (android.os.Build.VERSION.SDK_INT >= 11)
{
edittext.setRawInputType(InputType.TYPE_CLASS_TEXT);
edittext.setTextIsSelectable(true);
}
by set EditText focusable->false, keyboard will not opened when clicked
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false" />
create your own class that extends EditText
and override the onCheckIsTextEditor()
:
public class NoImeEditText extends EditText {
public NoImeEditText(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean onCheckIsTextEditor() {
return false;
}
}
You can do that:
textView.setOnClickListener(null);
It will disable the keyboard to the textView and the click will not work anymore.
If you take look on onCheckIsTextEditor() method implementation (in TextView), it looks like this:
@Override
public boolean onCheckIsTextEditor() {
return mInputType != EditorInfo.TYPE_NULL;
}
This means you don't have to subclass, you can just:
((EditText) findViewById(R.id.editText1)).setInputType(InputType.TYPE_NULL);
I tried setting android:inputType="none" in layout xml but it didn't work for me, so I did it programmatically.