1

I'm building an application where I have a GridView of results items are presented on the screen. When the user clicks one of the items, the results fragment is pushed to the side and a detail fragment is shown. I've used CommonsGuy implementation (https://github.com/commonsguy/cw-omnibus/tree/master/Animation/ThreePane) from Complete Working Sample of the Gmail Three-Fragment Animation Scenario? for that.

enter image description here

That works all well, the only thing is that I set the GridLayout for the results fragment from 3 columns to 1 column when pushing them left, which doesn't look nike and might confuse the user. How could I animate that transition?

Community
  • 1
  • 1
fweigl
  • 21,278
  • 20
  • 114
  • 205

1 Answers1

1

try this code

Fragment newFragment;
newFragment=new one_defalut();
FragmentTransaction transation=getFragmentManager().beginTransaction();
transation.setCustomAnimations(R.anim.slide_in_right, 0);
transation.replace(R.id.myfragment, newFragment);
transation.addToBackStack(null);
                    //transation.setTransitionStyle(FragmentTransaction.TRANSIT_FRAGMENT_FADE);

transation.commit();

code for slide_in_right.xml

<set xmlns:android="http://schemas.android.com/apk/res/android">
    <objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
    android:propertyName="x" 
    android:valueType="floatType"
    android:valueFrom="1280"
    android:valueTo="0" 
    android:duration="300"/>
</set>
ShreeshaDas
  • 2,042
  • 2
  • 17
  • 36