Android: ListView elements with multiple clickable buttons

后端 未结 8 1269
天命终不由人
天命终不由人 2020-11-22 01:58

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

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


        
8条回答
  •  耶瑟儿~
    2020-11-22 02:18

    I don't have much experience than above users but I faced this same issue and I Solved this with below Solution

    btnRemoveClick Click event

    public void btnRemoveClick(View v)
    {
        final int position = listviewItem.getPositionForView((View) v.getParent()); 
        listItem.remove(position);
        ItemAdapter.notifyDataSetChanged();
    
    }
    

提交回复
热议问题