我正在尝试使用此Time Preference Java类并将其转换为Kotlin:
public TimePreference(Context context) {
this(context, null);
}
public TimePreference(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public TimePreference(Context context, AttributeSet attrs,
int defStyleAttr) {
this(context, attrs, defStyleAttr, defStyleAttr);
}
public TimePreference(Context context, AttributeSet attrs,
int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
// Do custom stuff here
// ...
// read attributes etc.
}
我能够获取主构造函数,但不能获取辅助构造函数。我在运行时由于布局膨胀错误而崩溃。
class SpinnerPreference constructor(context: Context, attrs:
AttributeSet, defStyleAttributes: Int, defStyleRes: Int) :
Preference(context, attrs, defStyleAttributes, defStyleRes) {
}
答案 0 :(得分:0)
这次从commonsware的评论中再次仔细地检查了一下文档,这似乎是可行的:)。
catchError