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
Related
I want to create Application which looks i this way:
I will have lets say 6 Scroollable Lists (A,B,C,D,E,F). They should change by touch event.
For example we see Scrollable List B, I touch screen and move to left and next I see Scrollable List C, I touch screen and move it to right and I see Scrollable List B).
The name do Scrollable List (NameOfScrollableList shoud be change with touch event for Scrollable List)
How to do it? (I am not asking for code. I want to know a proper aproach to this problem :) )
If i understand correctly you want to horizontally scroll between your lists. Have a look at ViewPager, which is ideal for horizontal scrolling. The put a ListView inside each page of ViewPager.
That's what I'd do.
Most probably you are looking for ViewPager
This might help you
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.
I basically have 5 text views that fill in one on top of the other. Rather then just all showing up like they do now, I want them to all come in with some animation, one after the other. Anyone have a link to a tutorial on how to animate TextView objects? only one I saw in the android docs involved using images as well as needing an image in the background.
Animating a TextView is basically like animating any other view. If you want it to show up one after one, you can implement an AnimationListener and start the corresponding TextView when the previous has finished.
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.
i've now got the listview and it's touch actions and swipe actions working. But now i'm not sure how i can implement a swipe effect, like it's in the twitter app.
I've found in the internet that it's possible to animate 2 views with a viewflipper, but is it possible to animate two layouts in the same way?
Anyone out there, who knows how i can implement such a function?
The only thing i want is to switch the ListViewsItem layout with a swipe.
Simple, set both the item views in 2 separate thread and then start both of them.