Android Lollipop transition specific views in Activity Enter -


i trying implement new transitions api in application , stuck specific problem.

in activity want enter slide transition on specific views. here layout

<framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">  <com.github.ksoichiro.android.observablescrollview.observablescrollview     android:id="@+id/scroll"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:fillviewport="true">      <relativelayout         android:layout_width="match_parent"         android:layout_height="wrap_content">          <framelayout             android:id="@+id/header"             android:layout_width="match_parent"             android:layout_height="180dp">              <imageview                 android:id="@+id/ivrestaurantbg"                 android:layout_width="match_parent"                 android:layout_height="match_parent"                 android:adjustviewbounds="true"                 android:scaletype="centercrop"                 android:src="@drawable/background_poly" />              <relativelayout                 android:layout_width="match_parent"                 android:layout_height="80dp"                 android:layout_marginleft="15dp"                 android:layout_marginright="15dp"                 android:layout_margintop="70dp">                  <de.hdodenhof.circleimageview.circleimageview                     android:id="@+id/cvrestaurantlogo"                     android:layout_width="80dp"                     android:layout_height="80dp"                     android:layout_alignparentleft="true"                     android:layout_marginright="5dp"                     android:transitionname="sharedrestaurantlogo"                     android:src="@drawable/placeholder" />                  <linearlayout                     android:layout_width="wrap_content"                     android:layout_height="match_parent"                     android:layout_toendof="@+id/cvrestaurantlogo"                     android:layout_torightof="@+id/cvrestaurantlogo"                     android:gravity="center_vertical"                     android:orientation="vertical">                      <textview                         android:id="@+id/tvrestaurantname"                         style="@style/headertext"                         android:layout_width="wrap_content"                         android:layout_height="wrap_content"                         android:layout_marginbottom="4dp"                         android:textsize="20sp" />                      <textview                         android:id="@+id/tvrestaurantaddress"                         style="@style/headertext"                         android:layout_width="wrap_content"                         android:layout_height="wrap_content"                         android:textsize="15sp" />                      <textview                         android:id="@+id/tvrestaurantcontactno"                         style="@style/headertext"                         android:layout_width="wrap_content"                         android:layout_height="wrap_content"                         android:textsize="15sp" />                  </linearlayout>              </relativelayout>          </framelayout>          <view             android:id="@+id/anchor"             android:layout_width="match_parent"             android:layout_height="180dp"             android:minheight="180dp" />          <linearlayout             android:id="@+id/body"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:layout_below="@id/anchor"             android:orientation="vertical"             android:paddingbottom="@dimen/activity_vertical_margin"             android:paddingleft="10dp"             android:paddingright="10dp"             android:background="@android:color/white"             android:paddingtop="@dimen/activity_vertical_margin">              <include android:id="@+id/mapsegment" layout="@layout/card_map_lite" /> <!-- layout 1 transition -->              <include android:id="@+id/customersegment" layout="@layout/card_customer_details" /> <!-- layout 2 transition -->             <include android:id="@+id/orderssegment" layout="@layout/card_dish_details" /> <!-- layout 3 transition -->              <button                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:text="@string/accept_order"                 android:id="@+id/btnacceptorder"                 android:layout_margintop="10dp"                 android:background="@drawable/green_button"                 android:minwidth="120dp"                 android:minheight="50dp"                 android:textallcaps="false"                 android:textcolor="@android:color/white"                 android:layout_gravity="center_horizontal" />         </linearlayout>     </relativelayout>  </com.github.ksoichiro.android.observablescrollview.observablescrollview>  <include layout="@layout/gradient_header" />  <include layout="@layout/toolbar" />  </framelayout> 

and in activity this

@override protected void oncreate(bundle savedinstancestate) {     requestwindowfeature(window.feature_activity_transitions);     requestwindowfeature(window.feature_content_transitions);      transition transition = transitioninflater.from(this)             .inflatetransition(r.transition.shared_element_transition);      super.oncreate(savedinstancestate);      setcontentview(r.layout.activity_order_details);     mmapsegment = findviewbyid(r.id.mapsegment);     mcustomersegment = findviewbyid(r.id.customersegment);     morderssegment = findviewbyid(r.id.ordersegment);      transitionset set = new transitionset();      slide mapslide = new slide();     mapslide.setduration(2000);     mapslide.setslideedge(gravity.bottom);     mapslide.addtarget(mmapsegment);      //others ignored      set.addtransition(mapslide);      getwindow().setentertransition(set);     getwindow().setsharedelemententertransition(transition); } 

however not seem work. shared element transition works expected not enter transition. if remove slide.addtarget(mmapsegment) line, can see whole activity's views animated pretty sure has adding specific targets transition. doing wrong? appreciated.

i know asked while ago, had same issue happen me again thought share worked me. wrapped view trying slide in new linearlayout (match_parent/match_parent). not know why (normally useless) viewgroup allowed addtarget start working, has helped me more few times now.

to narrow down issue addtarget, replace target addtarget(view.class). if see entire screen transition, it's addtarget issue. otherwise else not wired correctly.

the other thing have android:transitiongroup="false" parent viewgroup of new linearlayout added. why need , not others, don't understand.

hope helps working on activity transitions.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -