我們查看源碼,Button實(shí)際上就是繼承TextView,并沒有實(shí)現(xiàn)什么方法,也沒有做特殊處理。
區(qū)別在于: 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); }
新聞熱點(diǎn)
疑難解答