我穿过所有给定的构造样式参考:如何在不使用样式属性的情况下设置自定义视图的样式?
public MyCustomView(Context context)
{
super(context, null, R.style.MyStyle);
}
public MyCustomView(Context context, AttributeSet attrs)
{
super(context, attrs, R.style.MyStyle);
}
public MyCustomView(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, R.style.MyStyle);
}
我的棉花糖尝试此。样式不适用,但在通过样式属性应用时起作用。
据我所知,有4个不是3视图的构造函数 – Selvin
是不是假设是'super'而不是'this' –