java - What is causing this animation flicker and how do I remove it? -
i have made tiny android application attempt resolve issue i've been seeing on different app. i'm trying achieve effect textview
starts off screen, scrolls on.
what did looks it's working on 4.0.4, when use android virtual device (4.1.2) there "flicker" showing textview
in original place before animation starts. i've noticed same thing on friend's tablet (4.4).
i uploaded video show issue here.
my layout:
<relativelayout android:layout_width="match_parent" android:layout_height="match_parent"> <textview android:id="@+id/txtv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" />
during mainactivity's onresume()
function move textview
off screen starting position:
@override protected void onresume(){ super.onresume(); view v = findviewbyid(r.id.txtv); animation hidewords = animationutils.loadanimation(getbasecontext(), r.anim.hidetext); hidewords.setanimationlistener(new animationlistener() { @override public void onanimationend(animation animation) { view v = findviewbyid(r.id.txtv); int xoffset = (int)(v.getwidth() * .1); relativelayout.layoutparams rlparams = (relativelayout.layoutparams)v.getlayoutparams(); rlparams.setmargins(-1*xoffset, 0, xoffset, 0); v.setlayoutparams(rlparams); }
and there's button has onclick set function animateit()
source of is:
public void animateit(view v){ v = findviewbyid(r.id.txtv); animationset = new animationset(true); animation showwords = animationutils.loadanimation( getbasecontext(), r.anim.texnation); as.addanimation(showwords); v.startanimation(as); }
the animation slides view
onscreen:
<set xmlns:android="http://schemas.android.com/apk/res/android" android:shareinterpolator="false" android:duration="700" android:fillafter="true" android:interpolator="@android:anim/linear_interpolator" > <translate android:fromxdelta="-100%" android:toxdelta="0%" /> </set>
so i'm trying figure out i've done incorrectly here that's causing flicker. right after button pushed first time text flickers on screen disappears , slides on expected.
any ideas?
Comments
Post a Comment