極力推薦文章:歡迎收藏
Android 干貨分享
閱讀五分鍾,每日十點,和您一起終身學習,這里是程序員Android
本篇文章主要介紹 Android
開發中的部分知識點,通過閱讀本篇文章,您將收獲以下內容:
1.自定義EditText 圓角矩形背景
2.自定義EditText 背景
Android
中自帶的 EditText
樣式比較丑,為了美化 EditText
可使用一下方法。
實現效果如下:
1.自定義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" />
2.自定義EditText 背景
<?xml version="1.0" encoding="utf-8"?>
<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>
至此,本篇已結束,如有不對的地方,歡迎您的建議與指正。同時期待您的關注,感謝您的閱讀,謝謝!