Animate part of Activity Launch - android

Is it possible to animate part of an activity launch?
I am not wanting my action bar to animate, however the rest of the view should slide in.
I have tried using a Gallery for this, however I have not been able to animate the gallery while programatically setting the selected view. This is because the gallery does not load more than the currently displayed view and its immediate adjacent views.

When you can use the viewflipper for this. Which shows 1 child at a time. You can set a IN and OUT animation for the views. So when you set the activew view index animations will be applied.

Related

How to stop backward animation of a gallery view

I used gallery view to display images but I want only one side to scroll. How do I stop left to right scrolling or backward scrolling? Or how do I create custom gallery?
GallerView is a deprecated widget.
I use ViewPager which you can modify as a custom gallery. Your fragments will be your slides or images which you will be able to swipe around.
You can read more about that here or here.
If you want to swipe only one way, then you would have to extend ViewPager and override onTouch event.

Android ListView/Gallery layout animation

I'm working with gallery widget.
I've attached layout animation that fades in element in gallery.
It works well.
But when I change content of gallery, and refresh adapter with notifyDataSetChanged();
New elements show up, but there is no layout animation for them.
How to implement that effect?
I frequently update gallery content, and I need that effect every time.
Here is a code:
<com.rtrk.gui.mainmenu.gallery.A4TVGallery
android:id="#+id/mainMenuGallery"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:layoutAnimation="#anim/a4tv_gallery_controller"
android:persistentDrawingCache="animation" />
// Notify new data
mainMenuAdapter.notifyDataSetChanged();
// Set default selection
mainMenuGallery.setSelection(defaultSelectedIndex);
TNX!
Layout animation as it is described in documentation "Defines the layout animation to use the first time the ViewGroup is laid out." So this is used only the first time you show your view.
I have recently done something similar, and I don't know if it is the best solution, but you can start the animation in the adapter when the system calls the getView method. The important thing there is not to create an animation object in the getView method but rather in adapter constructor just once and then reuse the same animation for the views you would like to show with the desired animation.
If you would like to show the animation only on the new views than create a flag that will signal whether the view has been shown for the first time and use the view IDs to associate the view with the correct flag.
Use the setAnimation method on the view rather then startAnimation if you want to control when the animation will be fired. It is useful if you want to create an effect where the views are gradually appearing on the screen.

How to slide views in Android

I have two image views in a table layout (two cells). Only one of the image views has an image displayed (the other is blank).
When a user taps on the view with the image, I would like the image to transition into the empty view.
Does anyone know how I can achieve this?
You could do it with a TranslateAnimation. If I were doing it, I would set the first one(which starts with the pic in it) to View.GONE, set the other to VISIBLE, then apply a translate animation to the second one that will slide it from the position of the first to where it is supposed to be.
This page has a nice tutorial on how to use various types of animations.

android ListView child animation

I build a Listview, each item of this Listview in a layout composed of a Gallery.
On click of an item of the Gallery, I want to translate it to the top of my screen.
Even with setZAdjustment(Animation.ZORDER_TOP); my gallery cell doesn't move outside the gallery.
I assume it's because it can't go outside it's parent view.
Is there a way to do this ?
Thanks
I assume it's because it can't go outside it's parent view.
you are right.
There is no way that you can move that exact view. What you can do is make yourself a new ImageView and add it to your top level layout right over the top of the selected cell. Set its image by calling .getDrawingCache() on the gallery cell. Then you can animate your new ImageView to where ever you want.
Depending on what you want to do with it once it has been moved this might work out for you. But fair warning it is a somewhat convoluted process to achieve the effect you're after

GridView in android

I have a gridview of images in android. When i click any item on it, i want to show a new set of items over it. This is the screen shot .
Can this be done using gridview? Also what should be the type of view which must come over the gridview? The background should become preferably faded.
I am not so sure if you can achieve the second view using a grid view. In the grid view AFAIK you don't have any option of specifying the location of the grid elements. It just arranges it from left to right and wraps around.
But here is how I would do it -
First view can be done using the grid
view, as you already know/done.
For the second view since you want the the first view to remain in the background, there are two ways to go about this -
First option
You can use a dialog, you can create your own custom dialog which has makes it translucent.
In this custom dialog you can add further elements like images.Custom dialog example. For details on how to make it translucent you can look the sample app in android sdk.
Second option -
Use a layoutInflater. Put all your views into it.
You can display one view on top of another using the visibility attribute of the view. Layout Inflater

Categories

Resources