更改边框颜色时的EditText集中 [英] Change border color when edittext is focused

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

问题描述

我想知道我怎么可以改变的EditText的边框颜色时,它的重点是,此刻,它看起来是这样的:

I am wondering how I can change the border color of the edittext when it is focused, at the moment it looks like this:

我试图在SDK中的源图像检查,但我不能做出任何意义,我也尝试过使用XML,但无法改变只有边框的颜色。

I have tried checking in the SDK for the source picture, but I couldn't make any sense of it, and I have also tried with xml, but was unable to change only the border color.

如果我发现了信号源的图像,我可以在Photoshop中编辑来改变颜色,我如何能做到这一点任何提示,或在源图像所在? :)

If I find the source picture I could edit in photoshop to change the color, any tips on how I could do this, or where the source picture is located? :)

推荐答案

您可以为您的EditText上创建自定义形状

You can create custom shape for your edittext

<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:state_enabled="true"
        android:state_pressed="true">
    <shape android:padding="10dp" android:shape="rectangle">
        <solid android:color="#FFFFFF" />
        <stroke android:width="2dp" android:color="#ffa0a496" />
        <corners android:bottomLeftRadius="15dp" android:bottomRightRadius="15dp" android:topLeftRadius="15dp" android:topRightRadius="15dp" />
    </shape>
</item>
<item android:state_enabled="true">
    <shape android:padding="10dp"
        android:shape="rectangle">
        <solid android:color="#FFFFFF" />
        <corners android:bottomLeftRadius="15dp" android:bottomRightRadius="15dp" android:topLeftRadius="15dp" android:topRightRadius="15dp" />
    </shape>
</item>

和设置背景:

editText.setBackgroundResource(R.drawable.yourFile);

这篇关于更改边框颜色时的EditText集中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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