public MaterialCompoundButton(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); LayoutInflater.from(context).inflate(R.layout.mcl_compound_button, this, true); mButtonView = (MaterialStateButton) findViewById(R.id.mci_compound_button_image); mSpaceView = findViewById(R.id.mci_compound_button_padding); mButtonText = (MaterialStateText) findViewById(R.id.mci_compound_button_text); mButtonView.setOnStateButtonCheckedListener(this); applyAttributeSet(context, attrs); }