2016-12-15 7 views
0

私は、私のフラグメントトランジション用のカスタムオブジェクトアニメーターを持っています。Androidバージョン6(Marshmallow)より前のアニメーションには問題ありません。FragmentカスタムオブジェクトAnimator Androidバージョン6以降 - Marshmallow

Fragment fr = new GameSizeFragment(); 
    FragmentManager fm = getFragmentManager(); 
    FragmentTransaction fragmentTransaction = fm.beginTransaction(); 
    fragmentTransaction.setCustomAnimations(R.animator.slide_in_left, R.animator.slide_out_right); 
    fragmentTransaction.addToBackStack(activeFragment); 
    fragmentTransaction.replace(R.id.fragmentPlace, fr); 
    fragmentTransaction.commit(); 
を:しかし、6の後に、アニメーションの中に私のフラグメントは、左スライドさせるための私のカスタムアニメーターがアニメーションでフラグメントを作成するには

<set xmlns:android="http://schemas.android.com/apk/res/android" > 

<objectAnimator 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:duration="500" 
    android:propertyName="x" 
    android:valueFrom="1000" 
    android:valueTo="0" 
    android:valueType="floatType" /> 

</set> 

ある

enter image description here

以下のように重なっ

誰かが私を助けることができます、なぜバージョン6の後に問題を引き起こしているのですか?

答えて

0

私の代わりにandroid.appのandroid.support.v4.appとしての私のフラグメントの使用量を変更し、そのオブジェクトのアニメーターを使用しての問題solved.Insteadようにあなたが

が右から入るのサポートV4と寝るのアニメーションを使用する必要があります見えますアニメーション

<?xml version="1.0" encoding="utf-8"?> 
<translate xmlns:android="http://schemas.android.com/apk/res/android" 
     android:duration="500" 
     android:fromXDelta="100%" 
     android:toXDelta="0%" /> 

は右アニメーションに入る

<?xml version="1.0" encoding="utf-8"?> 
<translate xmlns:android="http://schemas.android.com/apk/res/android" 
     android:duration="500" 
     android:fromXDelta="0%" 
     android:toXDelta="-100%" /> 

次にあなたの葉っぱを作ります

android.support.v4.app.Fragment fr = new YourFragment(); 
    android.support.v4.app.FragmentTransaction fragmentTransaction =  getSupportFragmentManager().beginTransaction(); 
    fragmentTransaction.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_right); 
    fragmentTransaction.addToBackStack(activeFragment); 
    fragmentTransaction.replace(R.id.fragmentPlace, fr); 
    fragmentTransaction.commit(); 
関連する問題