Hello,

In a LinearLayout I have 6 images inside ImageView containers. When I
click on one of them I want that one to "pop up" by say 10 pixels to
show it's been selected. I also need to have any other image
unselected by having it reset back to where the other images are.

I thought this would be simple, but it turns out it is far more
complex than I realised. I thought that I could increase the
ImageViews y location, but there is no access to that. So I looked
into LayoutParams and managed to get some sort of success, but then
realised it had ruined all my other layouts. So I looked into the
Animation classes and found Translate animation. I can now get it to
move slightly, but the darn thing then snaps back into place and won't
stay there.

This is driving me nuts. I mean it should be so simple, but how on
earth do you move ImageViews once they are laid out ? Below is my
animation code that I am trying, but how do I prevent it from snapping
back to where it is? I then also need to get it snap back only when
another image is selected.

[code]
 private View.OnClickListener cardClick = new View.OnClickListener()
    {
        public void onClick(View v)
        {
            //public TranslateAnimation (int fromXType, float
fromXValue, int toXType, float toXValue, int fromYType, float
fromYValue, int toYType, float toYValue)
            TranslateAnimation animation = new
TranslateAnimation(0.0f, 0.0f, 0.0f, v.getLayoutParams().height);
            animation.setDuration(500);
            v.startAnimation(animation);
        }
    };
[/code]

Regards
Anthoni

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to