我正在学习 Android 框架,想创建自己的自定义对话框,让我可以同时选择日期和时间。我正在查看 AlertDialog 源代码,构造函数调用方法 this(context, 0)。我通常与“this”引用相混淆。当作为方法调用时,我不确定它在这里意味着什么。
protected AlertDialog(Context context) {
this(context, 0);
}
最佳答案
this(context, 0)
在 AlertDialog 类中调用以下构造函数。
protected AlertDialog(Context context, @StyleRes int themeResId) {
this(context, themeResId, true);
}
上述方法创建了一个使用显式主题资源的警告对话框。
this()
用于调用类中的另一个构造函数。
关于java - this(context, 0) 是什么意思AlertDialog源码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38604093/