我可以让 WebView 元素“浮动”吗?在我的主布局之上?
是否可以使 WebView(或任何可以解析/显示 html 的视图)成为主布局顶部的“浮动”窗口?
基本上我有一个列表视图中显示的链接列表。当用户选择其中一个链接时,我想在浮动面板中加载并显示结果(有点像上下文菜单,但几乎占据整个屏幕并且可滚动),例如右上角的关闭按钮。因此,当用户查看完内容后,他/她只需单击关闭按钮即可返回到上一个列表页面。
这可能吗?或者我应该启动一个新的活动,为内容加载单独的布局,并使用一些跟踪机制返回列表页面。
非常感谢。
Is it possible to make WebView (or any view that can parse / display html) a "floating" window on top of the main layout?
Basically I have a list of links displayed in a listView. When the user select one of the link, i'd like to load and display the results in a floating panel (sorta like a context menu, but takes almost the entire screen and scrollable) with, say a close button on the top right corner. So when the user is done viewing the content, he/she can simply click the close button to return to the previous list page.
Is this possible? or I should start a new activity that loads a separate layout for the content, with some tracking mechanism to go back the list page.
Thanks much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我为应用程序的帮助部分所做的就是创建一个新的 Activity,其中仅包含一个 WebView,其 Theme.Dialog 在 AndroidManifest.xml 中设置:
这样,WebView 将作为当前窗口顶部的“浮动对话框”启动屏幕。
不确定这是否正是您想要的,但这是完成我需要做的事情的一种非常简单且有效的方法。
What I did for the help section of my application was to create a new Activity which just contains a WebView with the Theme.Dialog set in the AndroidManifest.xml:
This way the WebView is launched as a 'floating dialog' on top of the current screen.
Not sure if this is exactly what you want, but it's a very simple and efficient way to accomplish what I needed to do.