Sunday, February 28, 2010

[android-developers] Re: Animation fillAfter(true) and click locations

Hey Mark thanks for the insight. I did indeed try to move the control
but I am getting a class cast issue (can't for the life of me work out
why) so I kinda gave up on that root. My layout am animating can you
shed any light? I am using the following chunks.

public void onAnimationEnd(Animation animation)
{
if(arrowUP){
arrow.setBackgroundResource(R.drawable.arrowdown);
arrowUP = false;
Display display = ((WindowManager)
getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
mapHolder.setLayoutParams(new
LinearLayout.LayoutParams(0,arrow.getHeight()-display.getHeight()));

}else{
arrow.setBackgroundResource(R.drawable.arrowup);
arrowUP = true;
}

mapHolder.requestLayout();
arrow.requestLayout();

}


and the xml for that control looks like this

<LinearLayout android:orientation="vertical" android:gravity="top|
center_horizontal" android:layout_gravity="left" android:id="@+id/
maplayout" android:layout_width="wrap_content"
android:layout_height="fill_parent">
<Button android:text="" android:background="@drawable/arrowup"
android:layout_marginRight="5dip" android:layout_marginBottom="5dip"
android:layout_marginLeft="5dip" android:layout_marginTop="20dip"
android:id="@+id/Button01" android:layout_width="wrap_content"
android:layout_height="wrap_content"></Button>
<Button android:text="" android:background="@drawable/arrowup"
android:layout_margin="5dip" android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></Button>
<Button android:text="" android:background="@drawable/arrowup"
android:layout_margin="5dip" android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></Button>
<Button android:text="" android:background="@drawable/arrowup"
android:layout_margin="5dip" android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></Button>
<Button android:text="" android:background="@drawable/arrowup"
android:layout_margin="5dip" android:id="@+id/ButtonArrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></Button>
</LinearLayout>

The error I get is a classcast exception on trying to setLayoutParam.

Tom

On Feb 28, 6:48 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> Loki117 wrote:av
> > I had a quick questions around animations and what is going on. So I
> > have buttons in a vertical row down the side of the screen. Upon
> > clicking the last button the row animates and slides out at the top of
> > the screen. This works HOWEVER when the user clicks the same button
> > again (the only button still visible) nothing happens. It seems that
> > if I click where the button used to be the view reanimates. Does
> > anyone know why this happens or how I can fix it?
>
> I'm sure there's a purpose for fillAfter(true), but I have not found it.
>
> If you want the effects of the animation to be permanent, you need to
> add a listener to the animation, find out when the animation ends, and
> then take steps to make the changes that the animation simulates.
>
> So, for example, if you are sliding a button off of the screen, when the
> animation ends, you could make the visibility of that button be GONE, or
> remove it from its parent container, or something.
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android Consulting/App Development:http://commonsware.com/consulting

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate