android - How to make content transition with fragments? -
upon transaction fragment b, i'd specific view of fragment b move point x point y. should possible achieve using content transition: frament.setentertransition(object transition). don't understand should pass setentertransition(object transition)
in order tell specific view of b animate in specific way.
a lot can found on web refers shared element transition, can't find content transition.
assuming have fragment's layout:
<framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:background="@android:color/white" android:layout_height="match_parent"> <view android:id="@+id/shared_view" android:layout_width="50dp" android:layout_height="50dp" android:layout_gravity="center_vertical|right" android:background="#812432"/> <view android:id="@+id/non_shared_view" android:layout_width="50dp" android:layout_height="50dp" android:layout_margintop="80dp" android:layout_gravity="center_vertical|right" android:background="#fff53f"/> </framelayout>
and perform first fragment, initiates opening of second fragment:
slide slide = new slide(gravity.left); transitionset set = new transitionset(); set.addtransition(slide); set.addtarget(r.id.shared_view); fragment secondfragment = new secondfragment(); secondfragment.setentertransition(set); getactivity().getsupportfragmentmanager().begintransaction() .add(r.id.contentpanel, secondfragment) .addtobackstack(null) .commit();
you'll see, shared_view
slide left it's initial position, while non_shared_view
stay in it's place.
Comments
Post a Comment