为什么setBackgroundColor()没用,反而XML里的background可以
package com.example.lenovo.viewbutton; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.View; /** * Created by lenovo on 2018/10/31. */ public class NewButton extends View { public NewButton(Context context, AttributeSet attr) { super(context, attr); setBackgroundColor(0x44ff0000); } }