標籤:
main.xml
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> <!--hint 表示提示資訊,在輸入框中會有提提示 --> <!-- fill_paren寬度延長到整個螢幕 --> <!-- wrap_content高度與字型相對,包裹字型 --> <!--inputType輸入資料類型,此時表示輸入的是電話號碼 --> <!-- background輸入框的形狀設定,設定參數跳轉到drawable/shape裡設定 --> <EditText android:hint="我是EditText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputType="phone" android:background="@drawable/shape" /> </LinearLayout>
shape.xml
<?xml version="1.0" encoding="UTF-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <!-- 填充的顏色 --> <solid android:color="#FFFFFF" /> <!-- 設定矩形的四個角為弧形 --> <!-- android:radius 弧形的半徑 --> <corners android:radius="7dip" /></shape>
安卓EditText按鈕