如何从AlertDialog.Builder或等效版本构建AppCompatDialog? [英] How to Build AppCompatDialog From AlertDialog.Builder or Equivalent?

查看:129
本文介绍了如何从AlertDialog.Builder或等效版本构建AppCompatDialog?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在此之前,我使用DialogBuilder来创建AlertDialog这样的

Before this I used a DialogBuilder to create AlertDialog like this

AlertDialog.Builder builder = new AlertDialog.Builder(context);
...
...
AlertDialog dialog = builder.create();

如何从对话框生成器中构建新的AppCompatDialog,还是有另一种等效的新方法呢?

How can I build the new AppCompatDialog from a dialog builder, or is there another new equivalent way to do that?

推荐答案

刚刚找到了解决方案.我应该导入

Just found the solution. I should import

import android.support.v7.app.AlertDialog;

,然后AppCompatDialog dialog = builder.create()将起作用.

这篇关于如何从AlertDialog.Builder或等效版本构建AppCompatDialog?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆