0

I have done a easy calculator with numbers. I dont want the keyboard or what you call it to pop up when edittext touched. How can i disable it so i the number buttons can be used insted? I have no problems with the buttons, only the keyboard.

3 Answers3

0

This maybe of help https://stackoverflow.com/questions/1109022/how-to-close-hide-the-android-soft-keyboard

What you could also do is detect when the user selects the UI component such as:

txtEdit.setOnTouchListener(new View.OnTouchListener(){
    public boolean onTouch(View view, MotionEvent motionEvent) {                                                       
         // your code here....
         getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);                
         return false;
    }
});

Taken from (https://stackoverflow.com/questions/3389201/detect-touch-on-edittext-but-not-interrupt-it)

Community
  • 1
  • 1
Graham Smith
  • 24,739
  • 10
  • 43
  • 68
0

You could also just use a TextView instead and edit the text inside based on the button pressed.

Kizik Studios
  • 169
  • 2
  • 12
0

If I understand what your asking correctly you want to open the layout that your EditText is in and under its properties change its "Input type" to "number" or simply make your EditText look something like this in the xml file:

                <EditText
                android:id="@+id/YourEditText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:inputType="number" />

The important line is the android:inputType="number"

Peter
  • 4,740
  • 22
  • 74
  • 114