android - Slide up animation overlays fragment instead of animating both fragments in the same time -


hy guys,

i've got problem animation. i've got 2 fragments (a , b). button in fragment takes me fragment b. both fragments animate in transition. problem i've got, fragment b animates covering fragment a, instead of both animating up. here code:

slide in animation

<translate     android:duration="500"     android:propertyname="y"     android:valuefrom="100%"     android:valueto="0%"     android:valuetype="floattype" /> 

slide out up

  <translate     android:duration="500"     android:propertyname="y"     android:valuefrom="0%"     android:valueto="-100%"     android:valuetype="floattype" /> 

and method in code:

    public void showb() {      getsupportfragmentmanager()             .begintransaction()             .setcustomanimations(r.anim.slide_in_up, r.anim.slide_out_up)             .add(r.id.content, b.newinstanceadd())             .commit(); } 

thank in advance.

to replace fragment use :

replace(r.id.content, b.newinstanceadd()) 

instead of:

add(r.id.content, b.newinstanceadd()) 

otherwise it's hide/detach previous fragment.


Comments