Had a question about making part of a View Always-On-Top. Please see the Groupon picture below. The black window at the bottom where it says "From $29" & "Buy!" is always on top of the activity page. Meaning the rest of the page is scrollable above that black window at the bottom. Please note I only want this activity to have an Always-On-Top
How do I make a portion of the activity Always On Top? And what kind of layout did you think they used for Groupon? I was just going to make a RelativeLayout and layout_alignParentBottom="true".
You could probably get away with having a vertical linear layout with two children. The first one a scrollable area and the bottom a view with whatever it is you want to be 'on top'. Since there's no transparency there's no visual difference between having the black view as always-on-top and having one view on top of the other (in the y-axis, not z-axis). Plus, if you do it this way you can reach and see the bottom of the scrollable view's content.
To the best of my knowledge, the best way to do this is by implementing a BaseActivity with this View, and have all your activities extend this activity instead of the standard Activity.
Related
I am trying to create an activity layout with two parts, where their respective size is dynamic. The activity should have two states:
Starting state:
The user scrolls the bottom part up to the second state (and back):
It's important that the change will be animated. I tried a few solutions so far but didn't manage to find the exact way to do that:
AndroidSlidingUpPanel - The panel acts as another layout, covering the upper view and moving the toolbar out of the screen.
Android Split Pane Layout - Correct behavior, but the splitter is dragged and not the bottom part (I don't want to have a visible splitter).
CoordinatorLayout with CollapsingToolbarLayout - I didn't find a way to limit the upper part from totally disappearing. Anyway I think that it's a bit abusing because I don't want to collapse a toolbar but just change the children's height with animation.
Is there a good way to implement this using another library, one of these that I perhaps didn't use correctly or with simple layouts? Thanks!
I found a custom version of the SlidingPaneLayout created by VLC, which is basically a vertical SlidingPaneLayout - the exact functionality that I was looking for.
I'm experimenting to see if the layout scheme I want to use is possible. I want to have an XML layout that's scrollable. Within that scrollable layout, I want to have a single line going horizontally across the screen (I used just a View with a fixed height and different color). When that horizontal line reaches the top of the screen, and as I scroll down through the layout, I want it to stop and remain at the top of the screen while being able to scroll through everything below it.
I've been messing around in XML trying to get it to work, basically putting a bunch of junk before it and after it.
Any ideas as to how that might work? Would I have to do something fancy with the java code to fix the red line at the top when the scroll position reaches a certain point? Your help would be greatly appreciated.
I am assuming you want something like Gmail app where when you scroll a mail the header sticks on top... To do this, you need 2 views. You have your regular scroller below and overlay a fixed view on top (you can use a relative layout to do this). When your cell goes past a certain spot, you want to populate and set the visibility of the fixed view to VISIBLE. This would give the impression that the view you want to 'stick' to the top really just got stuck rather than scrolled out of view. You'll have to work out the opposite scrolling scenario too based on the location and height of the scrolled cell/view.
HTH
I need to make an android layout like this one.
tile background all over the screen.
top menu which, overlays the background ( note the shadow ).
some sort of a table with text options, maybe pictures, which can be scrolled up and down.
bottom menu, which appears by sliding up after a menu button is hit.
What kind of layout elements do you think I should use for that?
Thanks!
I think you should first learn about the Android Layout and XML layout design, then you can easily prepare this layout as well.
Relative Layout will be the better layout as compare to other layouts like Linear Layout and Table Layout.
To display middle part that is showing textual description may contains ListView (ListView because as you have mentioned Text Options should scroll up and down), but it depends on your requirement.
The RelativeLayout is the most flexible, and I think you can make all this with a minimal hierarchy view depth.
My approach would be to use a RelativeLayout. The Top Menu bar could be a custom class which extends a LinearLayout and this can be used in the RelativeLayout (in fact in any screen you have to provide UI consistency). Similarly, the bottom menu would be a custom control containing the appropriate animations. The rest of the screen would be contained in a ScrollView, possibly containing a TableLayout. I have something very similar using a MapView in the main screen and it works fine.
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.
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