Android - How to bring to front a webview - android

I have two Webviews but at certain point i would like to bring the one on the back to front. I want both visible.
Is it possible to change the layout order?

There is no concept of Z-axis position in Android view stack so you can't bring views to front or send to back. You need to set the view's visibility flag to hide, visible or invisible (.setVisibility(GONE , VISIBLE, or INVISIBLE) respectively). If you want them both visible at times then you need to have at least the top view (the one added to the parent view last) be with transparent background so that if their Visibilities are set to VISIBLE then the behind view will show through the top view.
Kevin

Related

Android view partly on top of scrollable active listview

I'm creating a music player where I have a listview-activity to choose songs from. Whenever I choose a song I need a smaller view to pop-up on the bottom of the screen, on top of the listview, just like edit-text when the keyboard pops-up.
But I also want to still be able to scroll the listview(when the song is playing) without the smaller view disappearing from the screen.
The smaller view will contain buttons for the player.
Is this possible?
If so, what is the best way to do this?
Any ideas?
A simple way of doing this could be to reserve as space for the smaller view and then set it's visibility to invisible, then when the song is picked set it's visibility to visible layoutelement.setVisibility(View.VISIBLE);
where your layout element is the piece who's visibility you are changing.
Since your whole layout is within a scroll view when your layout visibility is set to visible the other components of your layout will be pushed below and you'll be able to scroll through it all.

RecyclerView LayoutManager - force to keep a view even if not visible

I am animating views between two RecyclerView. The first one is something like a list of folders showing the first item as cover, clicking it opens a new view showing the folders content animating the cover to the first item. Clicking back animates all visible views back to the folder where they came from (the cover being the top most view). This looks great as long as the opened folder shows the first item. If I scroll down the first item will be offscreen and the back animation does not look that good anymore because the cover view is not animated (I'm only animating all visible views currently).
What I think would work is following: the LayoutManager could position the first item at a position shortly offscreen and keeps it as a special view in it's pool so that u always can access the first view and when I animate back to the folder view I can animate the cover in addition to all other currently visible items ( the cover will be animated from top of the screen).
This means I need following:
the LayoutManager must handle the first item as a special one that is not recycled (I may need it any time for the back animation)
the first item must always be layed out (either at the default position in the list, if it is visible or offscreen directly above the screen), again because I may need it at any time for the back animation
Can someone help me where to start here? I think this is possible with extending the LayoutManager but I don't know where to start...
Have you tried the following?
recView.getRecycledViewPool().setMaxRecycledViews(TYPE_XXXX, 0);

View being shown as merged with View beneath

I have two Views that are positioned on top of each other. The first stays in position and is visible at all times. The second has its visibility toggled by the user and slides in (and out) (using an animation) from (and to) the right of the screen. The problem is that the two Views when showing together, get merged such that you can see bits of the first View beneath the second View. Is there a property I can set on the second View such that it covers the first View totally out of sight?
Have you considered using ViewSwitcher?http://developer.android.com/reference/android/widget/ViewSwitcher.html

How to disable background screen

I have a LinearLayout A which is set inside onCreate() method by setContentView(), However i am creating a PopUp at runtime in same activity which is also a LinearLayout B, PopUp placed just bottom of the screen/activity, I want to to disable the background screen so that no touch/tap/click work.
How can i do that.
Thanks
This is how I could do it... I would recommend that you make the root of your layout a RelativeLayout, then put your LinearLayout A inside that. Your LinearLayout B should be the full size of your screen and have two views inside it (a top and bottom). The bottom view is your PopUp that you are already using. The top will just be a basic View that has a background color set to black with a .25 (or .1) alpha on it so that it's almost entirely see through.
When you want to display your popup (and disable interaction with the controls outside of the popup), add LinearLayout B to your relative layout attached to the top left (i.e. B should completely cover A). The user will be able to interact with your popup controls at the bottom and still be able to see LinearLayout A through the mostly transparent top portion of layout B, but since it is slightly grayed out the user will know they aren't allowed to interact with it... and will be prevented from interacting with it because the overlay view will block interaction.

Sliding in a layout for user input

I have a ListView and each item contains a TextView displaying a number. I'd like to give my users the ability to change this number while staying on the ListView (as opposed to drilling down into a detailed view by clicking on the list item).
What I'm looking to do is to slide in a layout from the bottom of the screen that covers about half of the screen. I'd like this layout to be OVER the Activity behind it (as opposed to being part of that Activity's layout and simply showing it). I'd also like it to be model (or seem modal). Meaning the Activity behind it can not be focused and manipulated. In this layout I will essentially create a calculator.
What I need help with right now is:
1) How to display a layout over the current Activity
2) How make the background (the Activity) modal
Could someone point me to some tutorials/resources and/or give me a few tips?
use an Animation. here is a small tutorial on them: http://developerlife.com/tutorials/?p=343
initially, the view you want to be modal must be placed where you want it to show up(and visibility set to gone).
use a translate animation to visually move the view from below the screen to halfway up the screen. once the animation starts, set visibility to visible
try disabling all views that the user should not be able to interact with after you have started the animation holding the calculator view

Categories

Resources