1

I have an EditText and a custom keyboard, so i want to avoid softkeyboard to popping up. It must never pop up, but i need also to leave EditText focusable to use cursor. Simple as it is but so hard to accomplish. I already tried a lot of solutions but they aren't working and since they are outdated i'm asking now for an actual working way. Solutions targetted as API 11 are such useless now since they don't work, already tried. I'd love to listen for suggestions from people who already tried the method on recent versions, such as Lollipop (API 21-22) or Marshmallow (23). I can't believe that there is no workaround, and i'm getting mad

Razinar
  • 727
  • 3
  • 13
  • 21

2 Answers2

0

This will help you

editText.setInputType(InputType.TYPE_NULL);
Ranjan
  • 390
  • 2
  • 10
  • this way you just disable the EditText, and that's is what i'm trying to avoid cause the cursor also disappears – Razinar Feb 12 '17 at 20:45
0

In your layout file add these line android:descendantFocusability="beforeDescendants" and android:focusableInTouchMode="true"

  <RelativeLayout  
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:descendantFocusability="beforeDescendants"
  android:focusableInTouchMode="true" >
  <EditText
    android:id="@+id/test"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"

</EditText>

</RelativeLayout>

In your Activity class add this line

this.getWindow().
setSoftInputMode
(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Vimesh Pk
  • 144
  • 1
  • 3
  • 8