1

我让它工作,但现在它不是。logcat 中没有关于它的内容。

样式.xml

<?xml version="1.0" encoding="UTF-8"?>
<resources>
    <style name="DialogSlideAnim" parent="@android:style/Theme.Dialog">
        <item name="android:windowAnimationStyle">@style/DialogAnimation</item>
    </style>
    <style name="DialogAnimation">
        <item name="android:windowEnterAnimation">@anim/push_right_in</item>
        <item name="android:windowExitAnimation">@anim/push_right_out</item>
    </style>
</resources>

爪哇

AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Are you sure you want to exit??? Your progress will be saved.")
    .setCancelable(false)
    .setPositiveButton("No", new DialogInterface.OnClickListener() 
        {
            public void onClick(DialogInterface dialog, int id) 
            {

            }
        })
    .setNegativeButton("Yes", new DialogInterface.OnClickListener() 
        {
            public void onClick(DialogInterface dialog, int id) 
            {
                dialog.cancel();
                finish();
            }
        });
AlertDialog alert = builder.create();
alert.hide();
alert.getWindow().getAttributes().windowAnimations = R.style.DialogSlideAnim;
alert.show();

有人看到这段代码有什么问题吗?在我进行额外编码之前,一切都在正常工作……我的活动中有大约 12 个警报框。

4

0 回答 0