2

I have an EditText, since I use a custom keyboard in my App, I have disabled the standard android keyboard. Unfortunately now seems that I cannot use the copy paste, selection etc when I click on the EditText in Jelly Bean, in Gingerbread my edit text has the desired behavior.

I need simply to disable the android keyboard to use my custom keyboard but the others copy-paste actions, selection etc, must be active

How could I fix this?

My EditText is this:

<EditText
            android:id="@+id/input"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp"
            android:autoText="false"
            android:background="@color/light_sky"
            android:cursorVisible="true"
            android:editable="true"
            android:gravity="left"
            android:imeOptions="flagNoEnterAction|flagNoExtractUi"
            android:scrollbars="none"
            android:singleLine="true"
            android:textSize="32dip" />
AndreaF
  • 11,106
  • 24
  • 92
  • 156
  • 1
    You see this? http://stackoverflow.com/questions/1109022/close-hide-the-android-soft-keyboard –  Aug 19 '13 at 15:37
  • @PANDA Yes but doesn't work. The keyboard is showed when I click the EditText widget. – AndreaF Aug 19 '13 at 21:18

3 Answers3

3

You proably have set a null input in your EditText.

If other situations you can prevent the keyboard showing simply using in the manifest

android:configChanges="orientation|keyboardHidden"

In this way the Android keyboard will not auto-open but is shown only if you click directly the EditText

Silverstorm
  • 12,730
  • 2
  • 34
  • 52
2

Building on this topic https://stackoverflow.com/a/10636686/2558337 i suppose that you should @Override onClickListener

inputField.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
        }
    });
Community
  • 1
  • 1
1

You could even try this that works

declare a InputMethodManager variable private InputMethodManager imm;

And in your onActivityCreated() method add these lines

// to hide the keypad
imm = (InputMethodManager) getActivity().getBaseContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(inputSearch.getWindowToken(), 0);

And to unhide use the following code

editText = (EditText) getView().findViewById(R.id.editText);
editText.setOnClickListener(new OnClickListener() {

      @Override
      public void onClick(View v) {
           // TODO Auto-generated method stub
           imm.showSoftInput(inputSearch, 0);
      }
});
VikramV
  • 1,061
  • 2
  • 11
  • 27