久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

聚焦edittext時(shí)更改邊框顏色

Change border color when edittext is focused(聚焦edittext時(shí)更改邊框顏色)
本文介紹了聚焦edittext時(shí)更改邊框顏色的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問題描述

我想知道如何在edittext獲得焦點(diǎn)時(shí)更改它的邊框顏色,目前它看起來(lái)像這樣:

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

我已經(jīng)嘗試在 SDK 中檢查源圖片,但我無(wú)法理解它,我也嘗試使用 xml,但無(wú)法僅更改邊框顏色.

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 中編輯以更改顏色的源圖片,有什么提示可以做到這一點(diǎn),或者源圖片的位置?:)

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 創(chuàng)建自定義形狀

You can create a custom shape for your EditText

1:STATE_ENABLED是檢查ET是否啟用/禁用.

1: STATE_ENABLED is to check if the ET is enabled/disabled.

2:STATE_PRESSED 用于檢查ET何時(shí)被按下(它會(huì)改變印刷機(jī)上的顏色,但不會(huì)保持這種狀態(tài).)

2: STATE_PRESSED is to check when the ET is pressed (it will change the color on the press but won't keep it that way.)

3:只要ET被聚焦,STATE_FOCUSED就會(huì)保持ET邊框顏色變化(滿足要求).

3: STATE_FOCUSED keeps the ET border color changed as long as the ET is focused(This fulfills the requirement).

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_enabled="true"
            android:state_focused="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>
</selector>

并設(shè)置背景:

editText.setBackgroundResource(R.drawable.yourFile);

這篇關(guān)于聚焦edittext時(shí)更改邊框顏色的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

EditText: Disable Paste/Replace menu pop-up on Text Selection Handler click event(EditText:禁用文本選擇處理程序單擊事件上的粘貼/替換菜單彈出)
Multiline EditText with Done SoftInput Action Label on 2.3(2.3 上帶有完成 SoftInput 操作標(biāo)簽的多行 EditText)
How to detect the swipe left or Right in Android?(如何在 Android 中檢測(cè)向左或向右滑動(dòng)?)
Prevent dialog dismissal on screen rotation in Android(防止在Android中的屏幕旋轉(zhuǎn)對(duì)話框解除)
How do I handle ImeOptions#39; done button click?(如何處理 ImeOptions 的完成按鈕點(diǎn)擊?)
How do you set EditText to only accept numeric values in Android?(您如何將 EditText 設(shè)置為僅接受 Android 中的數(shù)值?)
主站蜘蛛池模板: 天天综合久久 | 在线黄色av | 欧美视频免费 | www.黄色片 | 欧美久久久久久久久久 | 欧美日韩中文在线 | 免费a在线| 岛国一区二区三区 | 国产区一区二区 | 一区免费 | 欧美另类综合 | 欧美日本在线观看 | 精品视频一区二区 | 精品国产99久久久久久宅男i | 中文字幕亚洲综合 | 免费黄色一级 | 久久视频在线 | 国产视频一二区 | 高跟肉丝丝袜呻吟啪啪网站av | 欧美精品福利 | 国产盗摄一区二区 | 日韩一区中文字幕 | 蜜桃精品一区二区三区 | 亚洲视频一区二区三区四区 | 插插插视频 | 成人免费看片39 | 日韩一区二区在线视频 | 成人午夜在线视频 | 毛片毛片毛片 | 99热最新网址 | 在线免费看黄色 | 三级视频在线观看 | av网址在线免费观看 | 青青草视频免费在线观看 | 国产一级一片免费播放放a 免费国产视频 | av在线播放不卡 | 又黄又爽的网站 | 国产嫩草视频 | 国产精品久久久久久久久久久久午夜片 | 高跟肉丝丝袜呻吟啪啪网站av | 日韩视频在线免费观看 |