Focusable EditText inside ListView

后端 未结 13 2748
无人共我
无人共我 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

    Another simple solution is to define your onClickListener, in the getView(..) method, of your ListAdapter.

    public View getView(final int position, View convertView, ViewGroup parent){
        //initialise your view
        ...
        View row = context.getLayoutInflater().inflate(R.layout.list_item, null);
        ...
    
        //define your listener on inner items
    
        //define your global listener
        row.setOnClickListener(new OnClickListener(){
            public void onClick(View v) {
                doSomethingWithViewAndPosition(v,position);
            }
        });
    
        return row;
    

    That way your row are clickable, and your inner view too :)

提交回复
热议问题