は、私はすべて与えられたコンストラクタを通じてスタイル参照を渡さ:スタイル属性を使用せずにカスタムビューをスタイルする方法はありますか?
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);
}
私はマシュマロでこれをしようとしています。スタイルは適用されませんが、スタイル属性によって適用されると機能します。
私が知っている限り、3つのコンストラクタがありません。 – Selvin
は、 'this'の代わりに' super'であるとは思われません。 –