简体   繁体   中英

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?

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.

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 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.

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.

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