animation - android pop out (zoom) view on focus -


i have group of views, want 'pop-out' of screen when focused; sort of thing might see in menu on video game, example.

to achieve adding onfocuschaned listener these views runs zoomin animation on focus, , zoomout animation on losing focus:

@override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     viewgroup base = (viewgroup) this.getlayoutinflater().inflate(r.layout.gridtest, null);     viewgroup container = (viewgroup) base.getchildat(0);      this.animzoomin = animationutils.loadanimation(this, r.anim.zoomin);     this.animzoomout = animationutils.loadanimation(this, r.anim.zoomout);     int x=0;      for(view child:this.getviews(container))     {         imageview = (imageview) child;         i.setpadding(10,10,10,10);          if(x==0) { i.setbackgroundcolor(color.red); x++; }         else if(x==1) {i.setbackgroundcolor(color.green); x++; }         else if(x==2) {i.setbackgroundcolor(color.blue); x=0; }          i.settag(gridactivity.tag_empty);         i.setonfocuschangelistener(new view.onfocuschangelistener()         {             @override             public void onfocuschange(view v, boolean hasfocus)             {                 if (hasfocus)                 {                     v.startanimation(gridactivity.this.animzoomin);                 }                 else                 {                     v.startanimation(gridactivity.this.animzoomout);                 }             }         });     }      setcontentview(base); } 

zoomin.xml:

<scale xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_decelerate_interpolator" android:zadjustment="top" android:fillenabled="true" android:fillafter="true" android:fromxscale="1.0" android:toxscale="1.2" android:fromyscale="1.0" android:toyscale="1.1" android:pivotx="50%" android:pivoty="50%" android:duration="200" /> 

zoomout.xml:

<scale xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_decelerate_interpolator" android:zadjustment="bottom" android:fromxscale="1.2" android:toxscale="1.0" android:fromyscale="1.1" android:toyscale="1.0" android:duration="50" /> 

this works in far views zoom in , out correctly, z-ordering of views doesn't change... 'popped out' view overlapped (smaller) view right.

enter image description here

i have tried using v.bringtofront() appears move focused view end of parent layout, rather re-order z-wise.

(edit) effect i'm trying duplicate enter image description here


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -