Can I make WebView element "floating" on top of my main layout? - android

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.

Related

Android info button, new Activity or not?

I have to add a "info" button in my appliation of image retouching, so typically it's just a "i" logo in the menu bar, and when you click on it a list of severals values is showed on the entire screen with a back button at top-left.
I just want to know what is the best practice to do this. For me because it's a new screen I must use a new Activity. And not a Fragment because I want to have the same behavior on tablet. However may be it's better to do a fragment if in the futur I want to develop the informations on the half of the screen for tablets. But may be it's better to just switch content of the layout or setVisible() a part of it ?
Thanks in advance

Android - Show dismissable Dialog on TOP (like in Chrome) of the screen

I am currently trying to add a detail view feature for some elements of my app, and I am looking to display them like this dialog box in the Chrome app:
(It opens when you click on the https lock symbol)
The box should cover the entire top of the apps window and not leave space on top, right or left, just on the bottom of course. It also should be dismissable by clicking outside of it.
I was trying to do this for a while now but without success.
How can I achieve this?
You can achieve it in several ways.
First one
Create your own analogue of DialogFragment (don't extend existing one) with your view (which'll be placed in the top) and show it like this:
getSupportFragmentManager().beginTransaction()
.add(new MyDialogFragment(), android.R.id.content)
.commit();
android.R.id.content is like root view of your activity (setContentView() adds view on top of it).
Activity one
You can create Activity that will be transparent and 'll have this "card" on the top.
Third one
Just make Dialog appear at the top of screen. Like this.
No sure if this is what you need but have a look at this library.
https://github.com/Tapadoo/Alerter

Application level floating views with navigation in Android

I have to show a floating button that will be added in WindowManager so it remain on the top of all Activities. (I have done this part using https://github.com/marshallino16/FloatingView)
When that button is tapped I have to open screen and show detail view and navigate between other views. To achieve this thing I can do following things either adding
1 - PopUpWindow
2 - Dialog
But I cannot provide navigation using either of them. So my questions is.
What is the best way to add multiple views and providing navigation between them while keeping everything above the application that is running it.
How can we add Activity so that it won't pause user application?
You should open Activity and implement all navigation inside it.
Android may pause activities behind, so make your Activity only for part of the screen.
Inside Activity hide floating button and show it again on exit.

Sliding activity from right to left like menu slider android

I have a source code to do (Slider menu)..
But I want to do like it to just open a specific content, meaning that I want the second content to appear over the current content from right to left by pressing a button.
Hint: I'm not want to open activity totally by
overridePendingTransition(R.anim.animation, R.anim.animation2);
I just want the second content opens over the current content like what sliding menu acts.
(sliding menu appears from left to right by moving my finger from left to right, I want my second content opens from right to left and appears partially by pressing a button and back to hide my passing my fingers over it and move from left to right)
example: https://play.google.com/store/apps/details?id=com.wunderkinder.wunderlistandroid
Sorry if I could not explain, and hope anyone got my mean.
I think you got the "Activity" concept wrong.
I understand, you can never show 2 activities at the same time. An activity is not a "screen", "view" or something like that... it is a context itself. It covers a whole state in your application. If you want to do something like a slider, you can play with views, animations or even better, fragments.

Close Button for Button - Possible?

I am making an app that has a couple list view menus that lead to a file display. When the user opens a file (in a webview), I want to create a tab bar so that they can quickly refer back to this file even after going back through the menu and viewing a different file. I planned on creating a fragment activity that housed a horiz scroll view that housed buttons that referenced the file that they viewed. Then, when they move on to a different file, they can just hit the tab and return to the file referenced on the tab.
Couple things:
-the tab bar, once created, needs to persist across activities until closed by the user
-the tab bar needs to refresh itself every time the user opens a new file
-it would be really nice to have a little close button (like the red x in the corner in apple stuff) on the tab buttons, so that the user can close individual tabs.
Is this possible?
any suggestions, tips, etc ?
Is android's built in tabs a better way to go than horiz scroll view with buttons?
thanks in advance

Categories

Resources