开发者

android Custom ListView selected row on button click

开发者 https://www.devze.com 2023-02-04 23:31 出处:网络
I have custom listview with textview and button. I set the button click handle in the xml开发者_StackOverflow files and the implementation in the ListActivity.

I have custom listview with textview and button. I set the button click handle in the xml开发者_StackOverflow files and the implementation in the ListActivity.

The problem is when i click the button, I cant get which selected row that i click.

Regards


Are you using your own adapter? If so, you could certainly set a tag on the button, indicating it's position in the list.

something like

@Override
getView(... position ...){
//do stuff
  buttonView.setTag(new Integer(position));
//do stuff
}

Then later you can get check the view.getTag() onClick()

0

精彩评论

暂无评论...
验证码 换一张
取 消