How to do activity transtion? - android

I have implemented one App which has many activities.. . I want to implement one activity as left and right and vice versa in fling transition manner between whole activity. For example
SO when you hit next there should be transition between next activity and when you hit previous there should be transition between previous . How should i Implement this?. ... Its fling but not with touch, but using those buttons...

Check out ViewFlipper (video demo here), ViewPager, or ViewPagerIndicator.

Define translation animations in xml then use overridePendingTransition BEFORE setContentView in each Activity. E.g. overridePendingTransition(R.anim.slidein, R.anim.slideout); You probably need to put this in onResume if you want it to work both ways (i.e. when you're going from and back to that Activity.).

Related

Android: Activity sliding over another one with swipe gesture

I have two activities one with some data and the second one, semitrasparent with some buttons on it.
I want the second activity slide over the first one after the swipe gesture.
I've already read about ViewPager and it's not what I am looking for. I want the first activity still being visible over the semitrasparent second one.
I am looking for any suggestions how to do this.
Literally not possible.
The entire point of an Activity is that it fills the ENTIRE screen, and there are never 2 of them shown at the same time, ever.
So you can't swipe to "semi" open one with a slide animation.
To do that, you'll have to use 1 Activity, and multiple Fragments.

How to go about building an expanding fragment in Android?

So, I'm working on a media player application.
I would like to make something similar to Google Play Music's or SoundCloud's slide up mini-player to full-player UX.
I'm not really sure how to tackle that, though. Is it simply two fragments/views? I can understand how to transition onClick with animations, but how would I go about the fluid dragging?
Yes, it can be done with a fragment, OnTouchListener, and dragging the fragment up. I've done it with a click event and animation with no dragging.
The activity is on the bottom and the container with the fragment placed on top via the xml.
I wouldn't call it expanding though. Its just not fully revealed on screen (i.e. the location is on and off the screen and the fragment isn't actually changing).

How to pass slowly an animation pushing a button

I use a View Pager in my app to get animations between fragments, but I've got a problem because I use a button to pass fragments, I have disabled swipe option, and when a fragment pass to other, it is really quickly and you can not see anything. I want to pass more slowly so, Can you help me please?
I use this method to pass fragments:
myViewPager.setCurrentItem(int fragment_position);
If you need more information just say it.

How to slide between a CameraActivity and a ListView Activity?

I have an activity that displays a camera screen, another one that displays a dynamic list of things, and I would like to slide between them.
The problem is that the ViewPager only allows me to slide between different layouts, without any activity-related effect.
Thanks for your help!
I think that using a ViewPager is what would be the easiest way. But if you don't want to, maybe you can try something like that :
Code something to detect the swipe gesture.
When the swipe gesture is detected, start the second activity whith a slide transition.
I've never done something like that. It's just a though.

Android - How to change Activities within a TabActivity?

I currently have a TabActivity which has 4 tabs, within one of the tab's I want to be able to move forward and back between 4 different Activities.
However if I try to start a new Activity now it removes the TabActivty and starts a whole new Activity with no tab bars.
I have read about using view groups but that this is not best practice and also about using a view flipper but this doesn't seem to let me switch between different Activities only change the views within the Activity. I can't implement back functionality for exa,ple.
Can anyone point me in the right direction as to what I should be looking for as a solution to this?
EDIT:
Some more information:
Within the TabActivity my first screen will be a ListView that contains 4 rows, then selecting one of these will in turn load another ListView with 2 rows again within the TabActivity and then the 3rd screen will just contain some text depending on which option the user chose again within the Tab Activity.
Is a ViewFlipper the best solution here? It seems to me that it will require a lot of coding within one Activity if I use the ViewFlipper?
I have done something similar. I used the ViewFlipper to achieve this. You can override onBackPressed in your Activity so you can deal with moving back through your views.
There's a couple of ways of doing this but a simple way would be to just increment a counter in your Activity as you move to the next views, then in your onBackPressed method if counter != 0 just show the previous view, if counter == 0 call super.onBackPressed.
You can see in my video showing what the result could look like (ignore the bug being shown in the video).

Categories

Resources