简体   繁体   English

我可以让 WebView 元素“浮动”在我的主布局之上吗?

[英]Can I make WebView element “floating” on top of my main layout?

Is it possible to make WebView (or any view that can parse / display html) a "floating" window on top of the main layout?是否可以在主布局顶部制作 WebView (或任何可以解析/显示 html 的视图)“浮动” window ?

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.当用户 select 链接之一时,我想加载并在浮动面板中显示结果(有点像上下文菜单,但几乎占据整个屏幕并可滚动),比如右上角的关闭按钮. 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.或者我应该启动一个新的活动,为内容加载单独的布局,并使用一些跟踪机制将 go 返回列表页面。

Thanks much.非常感谢。

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:我为我的应用程序的帮助部分所做的是创建一个新的 Activity,它只包含一个 WebView,并在 AndroidManifest.xml 中设置了 Theme.Dialog:

    <activity android:name=".HelpActivity" android:theme="@android:style/Theme.Dialog"/>

This way the WebView is launched as a 'floating dialog' on top of the current screen.这样,WebView 在当前屏幕顶部作为“浮动对话框”启动。

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.不确定这是否正是您想要的,但这是完成我需要做的事情的一种非常简单有效的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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