1. 程式人生 > >安卓控制元件之按鈕(Button)

安卓控制元件之按鈕(Button)

概述:

android按鈕可包含文字、圖片和圖片及文字,分為ButtonImagetButton兩個控制元件。

ButtonTextView的直接子類,主要響應使用者的單擊操作,如常見的“確定”、“登入”、“註冊”按鈕等

屬性和方法:

XML屬性

方法

備註

android:text

setText(CharSequence)

設定按鈕文字

android:drawableLeft

設定左側圖片(上側drawableTop、右側drawableRight

底部drawableBottom)


例項:

總結:

layout_weight   針對match_parent,使一行中的多個物件平均分佈