嵌入 WebKit 是在 Android 应用程序中显示超链接对象和图像列表的正确解决方案吗?
根据我的阅读,您可以将 WebKit 嵌入到 Android 客户端应用程序中,甚至可以响应 WebKit 浏览器内发生的某些事件。我将向服务器端 API 发出请求,该 API 将返回项目列表。每个项目都将包含一个超链接、一个描述性简介和一个我也想添加超链接的小图标图像。我想向用户呈现典型格式的项目列表,如下所示{icon:blurb text:超链接以获取更多信息}。
嵌入 WebKit 并生成适当的 HTML 以提供给 WebKit 浏览器是最佳解决方案吗?或者是否有一个 Android 小部件可以做到这一点,并希望能够为我提供与用户与列表交互所生成的任何用户事件的可靠集成?
——罗施勒
From what I've read you can embed WebKit into your Android client application and even respond to certain events that occur inside the WebKit browser. I'm going to be making requests to a server side API that will return lists of items. Each item will contain a hyperlink, a descriptive blurb, and a small icon image that I also want to be hyperlinked. I want to present the user with a list of items in a typical format as follows {icon : blurb text : hyperlink for more information}.
Is embedding the WebKit and generating appropriate HTML to feed to the WebKit browser the best solution? Or is there an Android widget that does just this and hopefully gives me solid integration to any user events generated by by the user interacting with the list?
-- roschler
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您询问的 Android 视图是 WebView,它确实使用 WebKit来渲染 HTML。这看起来非常像它的本质——一个网页,在您的应用程序内部呈现。根据应用程序其余部分的功能,这可以正常工作,并且它也可以是迈向完全本机客户端的渐进步骤。如果您想编写一个使用其他本机 UI 元素的更丰富的应用程序,您只需使用 ListView,这是一个非常常见的事情,可以让你轻松处理各种 UI 交互。
The Android view you are asking about is the WebView, which does use WebKit to render the HTML. That's going to pretty much look like what it is - a web page, rendered inside of your application. Depending on what the rest of your app does, that can work fine, and it can also be an incremental step towards a fully native client. If you want to write a richer app that makes use of other native UI elements, you can just use a ListView, which is a very common thing to do and would allow you to easily handle all sorts of UI interactions.