如何更改 EditText 的边框颜色(未聚焦)? [英] How to change the border color(un-focused) of an EditText?

查看:40
本文介绍了如何更改 EditText 的边框颜色(未聚焦)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 EditText 的背景颜色更改为透明.现在 EditText 在未聚焦时看起来不可见.那么如何更改 EditText 的未聚焦边框颜色?

I changed the background color of the EditText to transperant. Now the EditText looks invisible when not focused. So how can I change the un-focused border color of EditText?

这个的 XML 属性是什么?

What is the XML attribute for this?

推荐答案

在 drawable 中创建一个包含以下内容的 XML 文件(比如 backwithborder.xml):

Create a XML file with the following in drawable (say backwithborder.xml):

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="#00000000" />
    <stroke android:width="1dip" android:color="#ffffff" />
</shape>

和 EditText 用户属性 android:background="@drawable/backwithborder"

and for the EditText user attribute android:background="@drawable/backwithborder"

这篇关于如何更改 EditText 的边框颜色(未聚焦)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆