OnItemClickListener was not work with the checkbox?

前端 未结 5 1262
青春惊慌失措
青春惊慌失措 2020-11-30 10:29

I have an item layout like this, and set the background by using item selector



        
5条回答
  •  隐瞒了意图╮
    2020-11-30 10:50

    You could add this code within your OnItemClickListener method:

    public void onItemClick(AdapterView parent, View view, int position, long id){
       CheckBox box = (CheckBox)view.findViewById(R.id.course_search_checkbox);
       box.setChecked(true);
    }
    

提交回复
热议问题