Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 857
adjfac Avatar asked May 02 '11 05:05

adjfac


1 Answers

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.

like image 117
Codemonkey Avatar answered Nov 13 '22 00:11

Codemonkey