自定义的 TextClock 小部件内部。

huangapple go评论58阅读模式
英文:

Custom TextClock in widget

问题

我尝试构建我的自定义TextClock并添加到小部件中。

和往常一样,我继承TextClock。当我在小部件中使用我的类时,小部件无法正常工作,但当我在活动中使用它时,没有任何问题。为什么会这样呢?

public class CustomTextClock extends TextClock {
    public CustomTextClock(Context context) {
        super(context);
    }

    public CustomTextClock(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CustomTextClock(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public CustomTextClock(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }
}
英文:

I try build my custom TextClock and add in widget.

As always, I inherit from TextClock. When I use my class in a widget, the widget does not work, and when I use it in activity, there are no problems. Why can it be so?

public class CustomTextClock extends TextClock {
    public CustomTextClock(Context context) {
        super(context);
    }

    public CustomTextClock(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CustomTextClock(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public CustomTextClock(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }
}

答案1

得分: 0

这个类的派生类在小部件中不受支持 自定义的 TextClock 小部件内部。

英文:

Descendants of this class are not supported in widget 自定义的 TextClock 小部件内部。

huangapple
  • 本文由 发表于 2020年10月6日 16:52:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/64222425.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定