我們查看源碼,Button實際上就是繼承TextView,并沒有實現什么方法,也沒有做特殊處理。
區別在于: TextView 用的是 textViewStyle public TextView(Context context, @Nullable AttributeSet attrs) { this(context, attrs, com.android.internal.R.attr.textViewStyle); }
Button用的是 buttonStyle public Button(Context context, AttributeSet attrs) { this(context, attrs, com.android.internal.R.attr.buttonStyle); }
新聞熱點
疑難解答