android - create alpha animation but not fill until button click -
i want set alpha view alphaanimation(1.0f, 0.15f); , click again reset alpha use code below:
button.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { if(fadeinout) { expcontrol.startanimation(set1); seekzoom.startanimation(set1); btnrotate.startanimation(set1); fadeinout=false; } else { expcontrol.startanimation(set); seekzoom.startanimation(set); btnrotate.startanimation(set); fadeinout=true; } } }); and animation set1 , set2 in below
private animation fadein(int t) { alphaanimation localalpha = new alphaanimation(1.0f, 0.15f); localalpha.setduration(800l); localalpha.setstartoffset(100l); localalpha.setfillafter(false); localalpha.setinterpolator(new accelerateinterpolator()); return localalpha; } private animation fadeout(int t) { animation fade; fade = new alphaanimation(0.15f, 1.0f); fade.setduration(800l); localalpha.setfillafter(false); fade.setinterpolator(new accelerateinterpolator()); return fade; } but when animation finish reset view fill alpha want alpha change button click
and not working setalpha(). want create app sdk 8 , above.
thanks.
// add line localalpha.setfillenabled(true); // modify other line localalpha.setfillafter(true);
Comments
Post a Comment