简体   繁体   English

单击TableLayout中的项目时如何从TableLayout中获取元素编号

[英]How can i get element number from the TableLayout while clicking on item from the TableLayout

单击“表格布局”中的项目时,如何从“表格布局”中获取元素编号?

You have to set a onclickListener to your row. 您必须在行上设置onclickListener。

In order to identify wich cell was clicked you could tag the view of each cell using view.setTag(uniqueID) when you create it. 为了确定单击了哪个单元格,可以在创建单元格时使用view.setTag(uniqueID)标记每个单元格的视图。

In your onClickListener function use view.getTag() to get the identity of your cell. 在onClickListener函数中,使用view.getTag()获取单元格的标识。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM