android - 在 android 9.0 中打开时对话框闪烁和故障
问题描述
我在 android 9.0 下方单击时打开对话框,在其打开时没有故障或闪烁,但在 android 8.0 下方并在其顺利打开下方。
我试图用下面的方式改变风格,但它也不起作用
<style name="mystyle" parent="@android:style/Theme">
<item name="android:windowIsFloating">false</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
</style>
public Dialog displayInPaddedScreenDialog(Context context, View view, DialogInterface.OnDismissListener onDismissListener) {
Dialog dialog = new Dialog(context, R.style.mystyle);
dialog.getWindow().getAttributes().windowAnimations = R.style.clubcard_Dialog;
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.copyFrom(dialog.getWindow().getAttributes());
lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
lp.width = ViewGroup.LayoutParams.MATCH_PARENT;
dialog.getWindow().setAttributes(lp);
dialog.setContentView(view);
dialog.setCanceledOnTouchOutside(true);
dialog.setOnDismissListener(onDismissListener);
dialog.show();
return dialog;
}
我希望在每个版本的 android 中它都应该顺利打开而不会闪烁或出现故障。
解决方案
推荐阅读
- javascript - Bridge.NET - 如何制作超链接
- python-3.x - 如何在 ASGI 应用程序中配置同步 SQLAlchemy ORM 使用?
- google-app-engine - 如何从 Google App Engine 静态文件 URL 中删除文件扩展名?
- azure - Azure 虚拟服务器上的 .Net 应用程序尝试连接到 Azure 数据库服务
- powershell - 带有 NuGet 上游源的 Azure DevOps Artifacts 源的安装包失败
- javascript - 对随后创建的元素做一些事情
- python - list_iterator 类在哪里定义?
- tensorflow - TypeError:无法将提供的值转换为 EagerTensor。提供的值:0.0 请求的 dtype:int64
- amazon-web-services - 如何解决:'无法解析要使用的 AWS 账户。它必须在定义 CDK 时或通过环境进行配置'
- java - 如何对在具有未知对象参数的构造函数的类中工作的方法进行单元测试(Junit 4)