ในการDialogFragmentเป็น Wrapper สำหรับDialogชั้นเรียนคุณควรกำหนดธีมเป็นฐานDialogเพื่อให้ได้ภาพเคลื่อนไหวที่คุณต้องการ
public class CustomDialogFragment extends DialogFragment implements OnEditorActionListener
{
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) 
    {
        return super.onCreateView(inflater, container, savedInstanceState);
    }
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) 
    {
        
        AlertDialog.Builder builder = 
            new AlertDialog.Builder( getActivity(), R.style.MyCustomTheme );
        builder  
        .setTitle( "Your title" )
        .setMessage( "Your message" )
        .setPositiveButton( "OK" , new DialogInterface.OnClickListener() 
            {      
              @Override
              public void onClick(DialogInterface dialog, int which) {
              dismiss();                  
            }
        });
        return builder.create();
    }
}
จากนั้นคุณเพียงแค่กำหนดธีมที่จะรวมภาพเคลื่อนไหวที่คุณต้องการ ในstyles.xmlเพิ่มธีมที่คุณกำหนดเอง:
<style name="MyCustomTheme" parent="@android:style/Theme.Panel">
    <item name="android:windowAnimationStyle">@style/MyAnimation.Window</item>
</style>
<style name="MyAnimation.Window" parent="@android:style/Animation.Activity"> 
    <item name="android:windowEnterAnimation">@anim/anim_in</item>
    <item name="android:windowExitAnimation">@anim/anim_out</item>
</style>    
ตอนนี้เพิ่มไฟล์ภาพเคลื่อนไหวในโฟลเดอร์res / anim :
( android:pivotYคือกุญแจสำคัญ)
anim_in.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <scale
        android:interpolator="@android:anim/linear_interpolator"
        android:fromXScale="0.0"
        android:toXScale="1.0"
        android:fromYScale="0.0"
        android:toYScale="1.0"
        android:fillAfter="false"
        android:startOffset="200"
        android:duration="200" 
        android:pivotX = "50%"
        android:pivotY = "-90%"
    />
    <translate
        android:fromYDelta="50%"
        android:toYDelta="0"
        android:startOffset="200"
        android:duration="200"
    />
</set>
anim_out.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <scale
        android:interpolator="@android:anim/linear_interpolator"
        android:fromXScale="1.0"
        android:toXScale="0.0"
        android:fromYScale="1.0"
        android:toYScale="0.0"
        android:fillAfter="false"
        android:duration="200" 
        android:pivotX = "50%"        
        android:pivotY = "-90%"        
    />
    <translate
        android:fromYDelta="0"
        android:toYDelta="50%"
        android:duration="200"
    />
</set>
สุดท้ายสิ่งที่ยุ่งยากก็คือการทำให้ภาพเคลื่อนไหวของคุณเติบโตขึ้นจากกึ่งกลางของแต่ละแถว ฉันคิดว่าแถวนั้นเต็มหน้าจอในแนวนอนดังนั้นในแง่หนึ่งandroid:pivotXค่าจะคงที่ ในทางกลับกันคุณไม่สามารถแก้ไขandroid:pivotYค่าโดยใช้โปรแกรมได้
สิ่งที่ฉันแนะนำคือคุณกำหนดภาพเคลื่อนไหวหลายภาพซึ่งแต่ละภาพมีค่าเปอร์เซ็นต์ที่แตกต่างกันในandroid:pivotYแอตทริบิวต์ (และมีหลายธีมที่อ้างอิงถึงภาพเคลื่อนไหวเหล่านั้น) จากนั้นเมื่อผู้ใช้แตะแถวให้คำนวณตำแหน่ง Y เป็นเปอร์เซ็นต์ของแถวบนหน้าจอ รู้ตำแหน่งเป็นเปอร์เซ็นต์กำหนดธีมให้กับกล่องโต้ตอบของคุณที่มีandroid:pivotYค่าที่เหมาะสม
ไม่ใช่วิธีการแก้ปัญหาที่สมบูรณ์แบบ แต่สามารถช่วยคุณได้ หากคุณไม่ชอบผลลัพธ์ฉันขอแนะนำให้ลืมDialogFragmentและสร้างภาพเคลื่อนไหวที่Viewเพิ่มขึ้นอย่างง่ายจากกึ่งกลางของแถว
โชคดี!