自定義 EditText 樣式

和你一起終身學(xué)習(xí),這里是程序員Android
經(jīng)典好文推薦,通過(guò)閱讀本文,您將收獲以下知識(shí)點(diǎn):
一、自定義EditText 圓角矩形背景
二、自定義EditText 背景
Android中自帶的 EditText樣式比較丑,為了美化 EditText 可使用以下方法。
實(shí)現(xiàn)效果如下:

自定義EditText 背景
一、自定義EditText 圓角矩形背景
自定義圓角矩形custom_edittext_background.xml
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:background="@drawable/custom_edittext_background"
android:gravity="center"
android:hint="自定義EditText"
android:padding="8dp"
android:textSize="16sp" />
二、自定義EditText 背景
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="5dp" />
<stroke
android:width="1dp"
android:color="@android:color/holo_blue_light" />
shape>
至此,本篇已結(jié)束。轉(zhuǎn)載網(wǎng)絡(luò)的文章,小編覺得很優(yōu)秀,歡迎點(diǎn)擊閱讀原文,支持原創(chuàng)作者,如有侵權(quán),懇請(qǐng)聯(lián)系小編刪除。同時(shí)感謝您的閱讀,期待您的關(guān)注。
點(diǎn)個(gè)在看,方便您使用時(shí)快速查找!
評(píng)論
圖片
表情
