Focusable EditText inside ListView

后端 未结 13 2387
无人共我
无人共我 2020-11-21 23:56

I\'ve spent about 6 hours on this so far, and been hitting nothing but roadblocks. The general premise is that there is some row in a ListView (whether it\'s g

13条回答
  •  梦谈多话
    2020-11-22 00:15

    I just found another solution. I believe it's more a hack than a solution but it works on android 2.3.7 and android 4.3 (I've even tested that good old D-pad)

    init your webview as usual and add this: (thanks Michael Bierman)

    listView.setItemsCanFocus(true);
    

    During the getView call:

    editText.setOnFocusChangeListener(
        new OnFocusChangeListener(View view,boolean hasFocus){
            view.post(new Runnable() {
                @Override
                public void run() {
                    view.requestFocus();
                    view.requestFocusFromTouch();
                }
         });
    

提交回复
热议问题