Friday 15 July 2011

android - unknown animator name : translate -



android - unknown animator name : translate -

getting error when animating fragment transaction.

fragment xml :

<framelayout android:id="@+id/relative" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="15dp" android:background="#009688"> <relativelayout android:layout_weight="0.5" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="0dp" android:id="@+id/linear"> <textview android:layout_margintop="35dp" android:id="@+id/mission" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="mission" android:textcolor="#ffffff" android:textsize="70dp" android:gravity="center_horizontal"/> <textview android:layout_below="@+id/mission" android:id="@+id/notimpossible" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="not impossible" android:textcolor="#ffffff" android:textstyle="bold" android:textsize="35dp" android:gravity="center_horizontal"/> </relativelayout> <relativelayout android:padding="10dp" android:layout_weight="0.5" android:layout_width="match_parent" android:layout_height="0dp" android:layout_below="@+id/linear"> <textview android:id="@+id/random_main" android:textsize="20dp" android:textcolor="@color/white" android:layout_width="match_parent" android:layout_height="wrap_content"/> </relativelayout> <textview android:id="@+id/ahead" android:clickable="true" android:layout_marginbottom="35dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:text="go ahead! " android:textsize="23dp" android:textcolor="@drawable/text_focus_white" android:layout_marginright="8dp" android:layout_gravity="right"/> </linearlayout> </framelayout>

fragment b xml :

<?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#cddc39">

code tranaction fragment fragment b:

fragb frag = new fragb(); fragmentmanager fm = getfragmentmanager(); fragmenttransaction ft = fm.begintransaction(); ft.addtobackstack("wtf"); ft.setcustomanimations(r.anim.slide_out_to_right, r.anim.slide_in_from_right); ft.replace(r.id.main,fragb); ft.commit(); </framelayout>

and here animation xmls

slide_in_from_right :

<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:shareinterpolator="false"> <translate android:startoffset="500" android:fromxdelta="100%" android:toxdelta="0%" android:fromydelta="0%" android:toydelta="0%" android:duration="700" /> </set>

here slide_out_to_right:

<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:shareinterpolator="false"> <translate android:fromxdelta="0%" android:toxdelta="100%" android:fromydelta="0%" android:toydelta="0%" android:duration="700" /> </set>

no, can utilize translate activities not fragment. need utilize objectanimator fragment.

look @ 1st reply in question, working :

android fragmenttransaction custom animation (unknown animator name: translate)

android

No comments:

Post a Comment