简体   繁体   中英

Android EditText no input with external blueTooth Hardware Keyboard

on testing my app on my tablet (Android 4.1.1 Asus) i find out that my bluetooth keyboard is not supported on my edittext. There is no input! Using the softkeyboard is no problem.

This is my layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent">
  <EditText android:layout_width="match_parent" 
            android:id="@+id/txtTuneScript" 
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:scrollbars="vertical" />              
</LinearLayout>

I'm missing any attibute for the editText? Any idea? Using an other app on the tablet like droidEdit, the bluetooth keyboard works fine...

I got this problem with a KeyEventListner which returned true.

    ed.setOnKeyListener(new View.OnKeyListener() {
        @Override
        public boolean onKey(View view, int i, KeyEvent keyEvent) {
            if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_ENTER
                || keyEvent.getKeyCode() == KeyEvent.KEYCODE_TAB) {
                useData(result);
                finish();
            }
            return true;
        }
    });

The surprising part is that virtual keyboard have working input while it still handle events.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM