开发者

android dynamic layout with variable textviews and events

开发者 https://www.devze.com 2023-01-24 05:49 出处:网络
I have a layout with dynamic content. It has a variable number of textviews. On each textview I have to attach an event, a click event.

I have a layout with dynamic content. It has a variable number of textviews. On each textview I have to attach an event, a click event.

I have to pass to that event some kind of开发者_Go百科 information to know what textview has been clicked exactly.

How can I pass this kind of information or how is the android way to do it?

Thanks


The onClick(View v) callback has View v on which you can do .getId() on. This gives you information about which of the textViews that was clicked.

0

精彩评论

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