android – Dialog主题动画问题

android – Dialog主题动画问题,第1张

概述我使用AlertDialog类创建了一个对话框.使用自定义视图.我想为它设置进入和退出动画.当我尝试执行该对话框时,将自身转换为小黑色背景视图.如何获得适当视图的动画? final AlertDialog.Builder builder = new AlertDialog.Builder( /*getContext()*/ new android.s 我使用AlertDialog类创建了一个对话框.使用自定义视图.我想为它设置进入和退出动画.当我尝试执行该对话框时,将自身转换为小黑色背景视图.如何获得适当视图的动画?


final AlertDialog.Builder builder = new AlertDialog.Builder(            /*getContext()*/            new androID.support.v7.vIEw.ContextthemeWrapper(getContext(),R.style.StyleDialog));    VIEw vIEw = getActivity().getLayoutInflater().inflate(R.layout.dialog_email,null);    builder.setVIEw(vIEw);    builder.setCancelable(false);    alert = builder.create();    alert.show();

这些都是风格

<style name="StyleDialog" parent="@androID:style/theme.Dialog">        <item name="androID:windowAnimationStyle">@style/DialogAnimation</item>    </style>    <style name="DialogAnimation">        <item name="androID:windowEnteranimation">@anim/fadein</item>        <item name="androID:windowExitAnimation">@anim/fadeout</item>    </style>

尝试了androID.support.v7.vIEw.ContextthemeWrapper和androID.vIEw.ContextthemeWrapper,但没有区别.

使用androID.app.AlertDialog类.

解决方法 我找到了解决方案.只是为我没有给出的布局设置背景(在我的情况下为白色).因为当我们设置自己的样式时,它默认使用黑色背景,如果不设置样式,则默认使用白色背景.

androID:background="@color/bg_white"

要获得适当的宽度,请将第一个视图宽度设置为match_parent.

机器人:layout_wIDth = “match_parent”

总结

以上是内存溢出为你收集整理的android – Dialog主题动画问题全部内容,希望文章能够帮你解决android – Dialog主题动画问题所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1128144.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存