android开发,在做登录页面的时候,经常要做一些无边框的用户、密码输入界面,网上搜索资料如下,共享出来我的制作过程
drawable目录下先建立一个XML文件,可以建立为login_edittext_all
<?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#FFFFFF" /> <!-- 因为的登录背景颜色为白色,所以设置成了白色,如果如其他颜色,根据自己的要求来设定-->
<corners android:radius="3dip"/> <stroke android:width="0dip" <!--边框宽度为0-->
android:color="#ffffff" /> </shape>
drawable目录下先建立一个XML文件,可以建立为login_edittext
<?xml version="1.0" encoding="UTF-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_window_focused="false" android:drawable="@drawable/login_edittext_all" /> <item android:state_focused="true" android:drawable="@drawable/login_edittext_all" /> <!--这个地方就是前面设置的xml文件名称--> </selector>
扫描二维码关注公众号,回复:
692208 查看本文章
在需要设置edittext总设置它的background
android:background="@drawable/login_edittext"
运行下看看效果吧