Android: ListView elements with multiple clickable elements

后端 未结 7 617
忘了有多久
忘了有多久 2021-01-03 11:22

I\'ve a ListView where every element in the list contains a TextView and two different Buttons. Something like this:

ListView
------------------         


        
7条回答
  •  一整个雨季
    2021-01-03 11:44

    dont add onItemClickListener for the listview rather add onClick for your required button and for checkbox do it like this

     CheckBox cbox = new CheckBox(this);// find your checkbox from the view here.
            cbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {

    @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub if(isChecked){ // do what ever you want. } } });

提交回复
热议问题