package skin.support.widget; import android.content.Context; import android.util.AttributeSet; import android.widget.LinearLayout; /** * Created by pengfengwang on 2017/1/13. */ public class SkinCompatLinearLayout extends LinearLayout implements SkinCompatSupportable { private final SkinCompatBackgroundHelper mBackgroundTintHelper; public SkinCompatLinearLayout(Context context) { this(context, null); } public SkinCompatLinearLayout(Context context, AttributeSet attrs) { this(context, attrs, 0); } public SkinCompatLinearLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mBackgroundTintHelper = new SkinCompatBackgroundHelper(this); mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr); } @Override public void setBackgroundResource(int resid) { super.setBackgroundResource(resid); if (mBackgroundTintHelper != null) { mBackgroundTintHelper.applySkin(); } } @Override public void applySkin() { if (mBackgroundTintHelper != null) { mBackgroundTintHelper.applySkin(); } } }