android - Animating Toolbar along with Fragment Transactions -
i have mainactivity implementing navigation drawer using below xml:
<android.support.v4.widget.drawerlayout xmlns:android ="http://schemas.android.com/apk/res/android" android:id ="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <linearlayout android:id="@+id/container_toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <include android:id="@+id/toolbar" layout="@layout/toolbar" /> </linearlayout> <framelayout android:id="@+id/content" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" android:background="#ffffff"/> </linearlayout> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="240dp" android:layout_height="match_parent" android:layout_gravity ="start" > <listview android:id="@+id/drawerlist" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margintop="5dp" android:divider="@color/material_blue_grey_800" android:dividerheight="1dp" android:background="#ffffff" /> </relativelayout> </android.support.v4.widget.drawerlayout>
now have 3 items in listview , on clicking on 1 of them code replace framelayout particular fragment below:
fragment f1 = new fragment() fragmenttransaction ft = getsupportfragmentmanager().begintransaction() ft.setcustomanimations(r.anim.slide_in,r.anim.hyper_out,r.anim.hyper_in,r.anim.slide_out) ft.replace(r.id.content, f1).addtobackstack(null).commit();
the above code works fine replacing fragment custom animations desired.however, question how animate toolbar along fragment during fragment transactions.
all fragments have respective toolbar titles changed in onactivitycreated() method of each fragment class following code:
((appcompatactivity)getactivity()).getsupportactionbar().settitle("title");
should applying animations layouts cover toolbar?
Comments
Post a Comment