android - FragmentActivity custom Fragment transition -
i trying make kind of transition on fragments, , using default application skeleton in eclipse creating fragmentactivity. noticed other posts specifying custom transition animation xml, being done on transaction, , none using fragmentactivity. (which btw easier.)
i know how make custom transitions in fragmentactivity. in advance!
edit: somthing this fragmentactivity.
musicplayeractivity.java
public class musicplayeractivity extends fragmentactivity { sectionspageradapter msectionspageradapter; viewpager mviewpager; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // init pager , set adapter msectionspageradapter = new sectionspageradapter( getsupportfragmentmanager()); mviewpager = (viewpager) findviewbyid(r.id.pager); mviewpager.setadapter(msectionspageradapter); //other init code ... } public class sectionspageradapter extends fragmentpageradapter { public sectionspageradapter(fragmentmanager fm) { super(fm); } @override public fragment getitem(int position) { switch (position) { case 0: return new mainfragment(); case 1: return new allsongsfragment(); case 2: return new settingsfragment(); default: return null; } } @override public int getcount() { // show 3 total pages. return 3; } /** * title supplied fragment number. */ @override public charsequence getpagetitle(int position) { locale l = locale.getdefault(); switch (position) { case 0: return getstring(r.string.title_section1).touppercase(l); case 1: return getstring(r.string.title_section2).touppercase(l); case 2: return getstring(r.string.title_section3).touppercase(l); } return null; } } //other methods }
activity_music_player.xml
<android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".musicplayeractivity$optionsfragment" > <android.support.v4.view.viewpager xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".musicplayeractivity" > <android.support.v4.view.pagertitlestrip android:id="@+id/pager_title_strip" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="top" android:background="#33b5e5" android:paddingbottom="4dp" android:paddingtop="4dp" android:textcolor="#fff" /> </android.support.v4.view.viewpager> <listview android:id="@+id/drawer" android:layout_width="160dp" android:layout_height="match_parent" android:layout_gravity="start" android:background="#333333" android:choicemode="singlechoice" />
as said in comment, you're using viewpager
. different performing animation on fragmenttransaction
.
what you'll want use viewpager.pagetransformer
. there details on how here
Comments
Post a Comment