I've seen many examples for implementing a card flip animation when transitioning between two fragments, however I need to implement it on two views within a single fragment. Basically, within a listview row we have some property details.
They the user taps a more button in the lower right, I want to flip the row's view so it shows the actions for that row instead.
I have card_flip_left_in.xml, card_flip_left_out.xml, card_flip_right_in.xml, and card_flip_right_out.xml animations in my Resources/anim folder. I wasn't sure how to proceed beyond this.
Related
The questions are quite FAQ-type, but I can't find any suitable tutorial and don't even know what exactly to search for
1) I've got a list filled with linearLayouts and need to set an animation for elements added to those layouts as shown on image. The animation is the element slides from under the existing layout elements. If an element is removed, the animation is the same reversed
2) There is a screen filled with elements. Tapping, for example, a certain button, you call a pop-up, which comes from the edge of the screen and is above the rest of the elements.
If you tap anywhere, except the pop-up,
a) it will slide back
b) you will interact with the objects which the pop-up does not cover
What makes such effects possible? How to implement them and what to read about?
For 1) Setting animateLayoutChanges=true for LinearLayout should do the job
For 2) You can open a Dialog on button click and customise the animations for the dialog by calling dialog.getWindow().setWindowAnimations('id of animation xml')
I am looking for some ideas on how to best achieve this effect. I have two fragments, one containing the map (and all controls) and another fragment that contains my RecyclerView to display the results. In my activity layout I would like to position my map and list fragments exactly how it is shown in this video. The map fragment shall stay aligned with the topmost edge of the list unless the user is actively scrolling the list upwards. The video I recorded should demonstrate what it is I am trying to achieve.
From an explanatory standpoint, I need view and layout ideas. I have already implemented all the necessary callbacks for all user interactions between the two fragments and the activity. One item in particular I am most interested hearing feedback on is how to align two views and then have the lower slide over the view when the user starts scrolling. Notice how the list (when showing) will not scroll downward.
One method I can suggest is to have both the map and the ListView in the same fragment and try this. It's the sliding drawer animation in Play Music.
For the part where touching the map shrinks the list view to a bar on the bottom. I suggest you create animations in the listView to shrink and to expand and call them on event Down and Up respectively. Here is the MotionEvent.
I am new to android therefore I got a little bit lost with all those ViewFlipper, ViewSwitcher, ViewAnimator and ViewPager. Moreover, I am not sure what's happening under the hood.
Basically I have an activity which shows some data. With swipe (or button, doesnt matter) I would like to scroll the view and get to another page (as seen in the picture below).
Is it possible to implement something like that without changing to another activity?
I am a little bit confused regarding views and access to the design elements. How those pages are located each to another? e.g. If I am currently seeing Page1, can I modify content of Page3? Or plainly saying, are all page views loaded all together? As if I set setContentView(R.layout.xlayout); then I can access only xlayout elements.
But if I use same activity, then I have a thread there which updates a counter on Page1, if I change view to Page 2, the counter will not find Page1 Counter TextView and will complain.
As I Understand Android 4.0 has ViewPager which is similar to the seen in the picture. I am using GB. Should I use support library or can I just go around and implement something similar without importing any libraries?
(Sorry, my description is a little bit messy)
Yes, you can use ViewSwitcher, ViewFlipper and ImageSwitcher depending on your requirements.
ViewSwitcher may have two childs at max. And these child might be a View or an object of subclass of view.
ViewFlipper: May have as many childs you want. and these child might be a View or an object of subclass of view.
ImageSwitcher might be used to switch images over.
By using view flipper you can display one item at a time, and adding a gesture overlay, you can apply sliding effect. To apply View Flipper, you need to add all the views to ViewFlipper, and showNext and showPrevious methods are used to show next and previous child.
You need to use a ViewPager to have the same behaviour as in Google Play.
it only available on recent version of Android, but you can use the Compatibility Package to make it available for older version.
With a ViewFlipper you can't "scroll" between two pages.
In my android app, I have a notion of "trails": a sequence of objects that the user can navigate. The same view, naturally, is used to display all objects, just updating components (texts, images, etc.) when the next object is to be shown.
Now, I want to animate the transition between objects: when the user navigates from an object to the next object, I want to use the slide animation from right to left (and the other way around). The issue is that I don't have two views to animate between - only one view. Therefore when I try to animate displaying this view (when the next object is to be loaded), the visible view disappears, I get a blank screen - and then the view slides in from the right.
What I want instead is to have the existing view to slide out and be replaced by a new view (same View but with different content) to slide in from the right.
How should I go about it?
Looks to me like a combination of LayoutTransition and GestureDetector. You might even a ViewFlipper in there too.
The LayoutTransition has an animation feature you might want to look into.
I haven't been able to figure out how to use LayoutTransition in my case, so instead of having my View, I replaced it with ViewFlipper containing two copies of my View. When I need to replace the view with another, I keep track of which of the two is currently displayed, then update the other off-screen and then use standard "slide-from-left" and "slide-from-right" animation with showNext(). This is more complicated than I really wanted it to be and uses more memory, but it does the job.
The solution turned out to be very simple: ViewPager. I provide PageAdapter, which returns two similar views (same layout, different content) and ViewPager takes care of the rest. If I wanted to disable the swipe page changes, all I had to do is extend ViewPager, override onInterseptTouchListener and return false.
how can i switch between two activities wich have the same header, for example an image. what i mean is, that their is an animation between the two activities, so the image is animated too. But i want, that only the body is animate and the image looks like freeze at the top. maybe i had to solve the probleme in another way because i have an activity with a listview inside an for example an imageview at the top. Now after i click on an item in the listview i want to refill the listview with an animation like move out - move in. i do so with two activities, but in this case, the imageview at the top is animated too. how can solve this problem. Do i need two activities or one. if(activity == one) { How can i animate the refill of the listview }
I hope you understand what i mean.
Thx for the answers!
But i want, that only the body is animate and the image looks like freeze at the top.
That is not possible with multiple activities.
How can i animate the refill of the listview
Have two ListView widgets and animate one out and the other in, putting your new data into the one that is animating in. You could accomplish this with a ViewFlipper as the container, or apply the animations directly to the widgets.
Or, switch to fragments (Android 3.0 and the Android Compatibility Library) and use FragmentTransactions to animate a pair of ListFragments.
You can do it only inside one activity.
You should implement Tweened Animation for list view and start it any time it was updated