this(context, 0) 是什么意思AlertDialog源码
What does this(context, 0) mean AlertDialog source code
我正在学习 Android 框架并想创建我自己的自定义对话框,允许我同时选择日期和时间。我正在查看 AlertDialog 源代码,构造函数调用方法 this(context, 0)。我通常与 "this" 参考混淆。我不确定作为方法调用时在这里意味着什么。
protected AlertDialog(Context context) {
this(context, 0);
}
this(context, 0)
在 AlertDialog class 中调用以下构造函数。
protected AlertDialog(Context context, @StyleRes int themeResId) {
this(context, themeResId, true);
}
上述方法创建了一个使用显式主题资源的警告对话框。
this()
用于在 class.
中调用另一个构造函数
This
关键字指的是您当前工作的 class。
this(context, 0);
它实际上是在调用具有两个参数的 AlertDialog 构造函数。
我正在学习 Android 框架并想创建我自己的自定义对话框,允许我同时选择日期和时间。我正在查看 AlertDialog 源代码,构造函数调用方法 this(context, 0)。我通常与 "this" 参考混淆。我不确定作为方法调用时在这里意味着什么。
protected AlertDialog(Context context) {
this(context, 0);
}
this(context, 0)
在 AlertDialog class 中调用以下构造函数。
protected AlertDialog(Context context, @StyleRes int themeResId) {
this(context, themeResId, true);
}
上述方法创建了一个使用显式主题资源的警告对话框。
this()
用于在 class.
This
关键字指的是您当前工作的 class。
this(context, 0);
它实际上是在调用具有两个参数的 AlertDialog 构造函数。