自定义 EditText 样式

640?wx_fmt=gif

640?wx_fmt=gif

640?wx_fmt=other

极力推荐文章:欢迎收藏Android 干货分享 

640?wx_fmt=other

本篇文章主要介绍 Android 开发中的部分知识点,通过阅读本篇文章,您将收获以下内容:

1.自定义EditText 圆角矩形背景

Android中自带的 EditText样式比较丑,为了美化 EditText 可使用一下方法。

640?wx_fmt=jpeg

自定义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>

640?wx_fmt=jpeg

640?wx_fmt=jpeg

长按识别二维码,领福利

至此,本篇已结束,如有不对的地方,欢迎您的建议与指正。同时期待您的关注,感谢您的阅读,谢谢!

如有侵权,请联系小编,小编对此深感抱歉,届时小编会删除文章,立即停止侵权行为,请您多多包涵。

640?wx_fmt=gif

640?wx_fmt=png

posted @ 2019-04-17 12:10  程序员Android的博客  阅读(405)  评论(0)    收藏  举报