Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 Android 开发的新手。我的列表视图中有大约 500 个条目,每次单击都会打开本地 html 文件。 我是否必须手动编码所有 switch 语句? 我可以匹配列表中项目的索引以打开相应的html文件吗? 谢谢!
如果您在名称中使用数字命名 html 文件,则可以将这些数字与列表中的位置相匹配。就像,htmlfile001.html 将位于位置 1。然后 listAdapter 中的 getView 从该位置组装名称,并显示文件名,然后 onclick 将文件名发送给查看器,在意图中。