简体   繁体   中英

How to add onclick to cardview in android to open link in webview

我有 gridview 中的卡片列表都是静态的,我想在每张卡片上添加 onclick 并在点击不同卡片的不同链接时在 webview 中打开一个链接。

https://antonioleiva.com/recyclerview-listener/

use this for reference for onclick item of recyclerview.

NOTE

below sentence will be understood, only when you follow the above link

Now after doing all the steps, you will have a method in Activity after implementing the interface. pass the position to the method.

In that method, add switch case, based on position you got, call the webview with that particular uri.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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