android animating views between pages - android

I have been researching for the same since two days. Here is what i want to achieve. I havent ever tried much animations in android so please clear my approach wherever required. I will have two pages/screens (one visible at a time) Now when I am on page1, on swiping right to left page 2 will be displayed (achieving this is not that difficult) But here is my problem : when I am scrolling to page2 i would like to animate/translate/slide an image from page1 to page2 (without touching the image) and let the image sit on page2. I am just not sure of how to start with this.
I have thought of few ideas
First: I think i should implement a layout larger then window and then do the required animations and scrolling in it using horizontal scrollview.But now here I am not sure how will I make it look like they are 2 different pages(concerned about handling different screen sizes)
Second:I have seen example libraries of draggable gridview viewpager. But here both of my pages will have different layouts
Third:I am thinking of dividing both of my pages. the lower part of my pages will contain framelayout where I will only change the framelayout's content on scroll and perform hide n show trick on the upper part.But here again the trick is how am I supposed to place the image(contained in framelayout) to upper layout with an animation(image sliding to the top side on its own kind of animation)
Any Ideas. Any views/suggestions. Need all of it.Thank You for your valuable time.
This happens when I am trying to move the image to screen's top-left position. It moves in the left top direction as shown in the images below..
This happens when I am trying to move it besides second fragment textview
But the problem is I want to move it besides second fragment textview while scrolling and when scrolling is done it should come to top left of the screen just like the second fragment textview

Related

How to transform CardView size and form on swipe up or click event?

Is it possible on selected CardView swipe up or click (if swipe up not possible) to make CardView fill ~90% of the screen. And when clicked again, it shrinks down to its original form.
The important part is that it has to be on the same view as google maps are, so transition to other activity won't work for me and also I will be adding addition content to CardView when it will be enlarged.
I don't need exactly specifics on how to do it, but at least where to start.
Right now you can swipe left and right, and it will add shadow to object and enlarge current item.
Link to .xml and transform class code: https://pastebin.com/0trtw1E1
Basically, i'm trying to implement https://github.com/mciekurs2/ViewPagerCards, but with a little bit of a twist.

how to control Android ScrollView to go all the way to top or bottom but never middle?

I have a fragment with a scrollview that holds a long layout essentially representing 2 different sections that are related, what I want is to control the scrollview so when the user wants to scroll down it always goes all the way down and can never be in the middle so it will never reveal partially the top or bottom parts, same effect backwards when you want to scroll up it just takes over and goes all the way up to reveal the top section of the layout fully.
It is basically how a vertical viewpager will behave but contained within a single long view.
I know how to programatically scroll up or down but I don't know how to avoid the user scrolling to just the middle, I'd like to hook up to some scroll event, detect the direction and go fully in either direction.

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

How to create a gridview with spacing at the top

I was looking to create a GridView that stretches across the entire screen. However, when the user first opens the screen, the top of the first item should be about halfway up the screen.
For example lets say we have a GridView of 12 items displayed 3 x 4. When the user first opens the screen, only the first six items would be seen with a large margin at the top of the screen. The user can then scroll the list to see the other items. The top items would eventually reach all the way to the top of the screen.
If I was using a ListView, this is simple. I merely create a 0dp headerView with a large top margin. But, GridViews do not allow for headers. What is the best way to handle this situation?
Normally, you DO NOT make a GridView inside a ScrollView. It's not recommended! But sometimes you have no choice and you need to addHeaderView() on a GridView (But I repeat, it isnt recommended).
So, to make this happen, you have to make a custom GridView. This answer will be usefull in your case: Grid of images inside ScrollView
I had a same situation and I used this one: HFGridView by #SergeyBurish! Very simple and really great. (See the last answer here: A GridView with header and footer).
Hope this will be helpful.

android horizontal scrolling with buttons

Hi im wanting to create a function that allows the user to swipe left and right and a button slides in horizontally. for example there will be a big button on screen when you swipe it moves horizontally and another big button could anyone point me in the right direction as i have no idea where to start with it?
heres an example of what i'm looking for
you can use viewpager: http://developer.android.com/reference/android/support/v4/view/ViewPager.html
and when the current page changes (there is a listener to do this) you can change the circle images at the bottom to show the properly page.
:)

Categories

Resources