How do you transition without the background moving? - android

I've looked around for a while and cant find the answer. How do you make a screen transition so that the background stays in place while the elements displayed move? Basically, Im trying to emulate the look for sliding through pages of apps on an iphone or android phone. Any way to do this? Do i have to use fragments? This question has kind of bad wording, ask me to clarify if you're confused on anything.

Use a frame layout with the background set as an image that you want. with a view pager as a child view. The view pager will use different fragments and the view pager should have each Fragment with a transparent background. Let me know if you need help with that any more, it should work no problem.
If the background is more complicated, use another layout to hold child views and still have the main layout be a frame layout. You want the frame layout because it can stack views on top of eachother. Put the view pager as the last view in this case, and ensure each Fragment is transparent.

Related

Android: Making the toolbar slide up and down along with the Recycler View

I've been using Phonograph music player for a while and it's a really good looking app in my opinion. It has a very nice sort of header: basically there's the toolbar wich slides up and down along with the recycler view hiding behind the status bar when scrolling down and coming back visible when scrolling up, the difference with other toolbars show/hide animations is that this one does not actually have two rigid states (hidden or shown) but instead it can be half covered, 70% covered, 80% covered and so on, it moves at the same speed of the recycler view, it's really different than the ActionBar.hide() .
Little clip to explain what I'm talking about:
http://i.imgur.com/JCIiFAA.jpg
I've searched the web for solutions but I haven't found nothing close enough but I think that the Observable Scroll View library might be a good starting point (Have already done some testings but so far it has those 2 rigid states wich I don't want).
I am using an activity MainActivity.java and setting its content view to activity_main.xml, how can I achieve that result?
Also how can I make that view pager selector just below the toolbar but sticky?
CoordinatorLayout from Design Support Library is what you are looking for.
See Tutorial here https://mzgreen.github.io/2015/06/23/How-to-hideshow-Toolbar-when-list-is-scrolling(part3)/
First of all you need to wrap up your Layout with Coordinator layout and set this flag on Toolbar
app:layout_scrollFlags="scroll|enterAlways"

Covering most of a view with an overlay Android

When covering a view with an overlay I am aware that I need to use a FrameLayout, and the child views stack on top of each other. Setting a view to having a background with opacity will create the overlay effect. However, in my situation, I am required to create a hole in my overlay to display the contents of a tab item / other views beneath it. This is where I am stuck.
I am not sure how to perform the intersection on the view so that it is transparent in a specific area of the view (which I need to determine based upon the position of a specific View element (Tab, ImageView, etc).
The image above shows the result I want to achieve. With the entire view having an overlay on it, besides one of the Tabs and the Info box (which needs to move based on the view displayed through the overlay).
I believe I need an intersection of the views to achieve the result I need...this is something I am not sure about. Can someone point me in the right direction of a solution please, I do not expect to be just given a solution, its all about learning!

Center image on remaining space when scroll on ViewPager android

I saw beatport's app intro with viewpager, and what I want is to create that effect on scroll, for example, when changing to the next fragment, the background image of the fragment before adjust itself in the center of the remaining space.
Maybe I wasn't very specific, I'll be glad if you could take a look at beatport's app Intro for more understanding. The effect is called Parallax and I found this pieces of code, but I canĀ“t implement my fragments, only the images.
Here is the code:
https://github.com/je4a/ParallaxViewPager/tree/master/sample/src/main/java/com/parallaxviewpager/sample

Sliding up view in android. without including that view in every layout

I need to show a view sliding up for all my pages(fragments). Just like navigation drawer working. I don't want to include layout in every view and animate. Please suggest a solution
Create a common base class that your fragments extend from. What is the purpose of the sliding view? Does is just animate a scroll within a fixed space? Does it move above it up when it animates in? Does it overlay over the view as it slides up? Need more clarification.
You can use something like AndroidSlidingUpLibrary.
I'd avoid using it for scrolling views, it is nice though.

How do I make a section of an activity always-on-top?

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.

Categories

Resources