android - TranslateAnimation applied to an ImageView leaves trail -
i've been struggling translateanimation framework provided android ui library.
i have designed relativelayout has gridview taking 80% of screen more or less , imageview @ bottom of screen. latter it's supposed moving around botttom of screen constantly, random directions.
here's layout:
<imageview android:id="@+id/bottom_fish" android:layout_alignparentbottom="true" android:adjustviewbounds="true" android:croptopadding="true" android:scaletype="centerinside" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginbottom="40dp" android:layout_alignparentleft="true" android:layout_weight="0" android:src="@drawable/little_fish_right" ></imageview> <gridview android:id="@+id/gridview" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:layout_above="@id/mouin_bottom" android:columnwidth="90dp" android:numcolumns="4" android:verticalspacing="10dp" android:horizontalspacing="10dp" android:stretchmode="columnwidth" android:gravity="center" />
and here's translateanimation:
translateanimation slide = new translateanimation(x0, newx, y0, newy); slide.setfillafter(true); slide.setinterpolator(new linearinterpolator()); slide.setduration(duration); slide.setanimationlistener(animationlistener); iv.startanimation(slide); x0 += newx; y0 += newy;
the animationlistener assigned animation calls method on onanimationend function.
the matter when image moving right left eventlually leaves bitmap traces on screen, being removed after while.
any idea problem placed?
thank you.
after call iv.startanimation(slide)
, may need call invalidate()
on view's parent. i've had problem before. i'm assuming you've solved issue before, helpful others.
Comments
Post a Comment