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

聚焦edittext時更改邊框顏色

Change border color when edittext is focused(聚焦edittext時更改邊框顏色)
本文介紹了聚焦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 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何時被按下(它會改變印刷機上的顏色,但不會保持這種狀態.)

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就會保持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>

并設置背景:

editText.setBackgroundResource(R.drawable.yourFile);

這篇關于聚焦edittext時更改邊框顏色的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

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 操作標簽的多行 EditText)
How to detect the swipe left or Right in Android?(如何在 Android 中檢測向左或向右滑動?)
Prevent dialog dismissal on screen rotation in Android(防止在Android中的屏幕旋轉對話框解除)
How do I handle ImeOptions#39; done button click?(如何處理 ImeOptions 的完成按鈕點擊?)
How do you set EditText to only accept numeric values in Android?(您如何將 EditText 設置為僅接受 Android 中的數值?)
主站蜘蛛池模板: 精品久久香蕉国产线看观看亚洲 | 色视频一区二区 | 欧美a在线观看 | 日韩欧美三区 | 一区二区国产精品 | 在线成人| 欧美成ee人免费视频 | 日韩毛片在线视频 | 欧美色图综合网 | 亚洲码欧美码一区二区三区 | www.狠狠操 | 激情五月婷婷综合 | 97国产精品 | 日韩免费一区 | 日韩国产精品一区二区三区 | 91在线精品播放 | 久久99久久99 | 国产成人精品久久二区二区91 | 污免费网站 | 亚洲精品自在在线观看 | 特黄色一级毛片 | 午夜男人的天堂 | xnxx 日本免费 | 中日韩欧美一级片 | 欧美日韩在线高清 | 久久久性色精品国产免费观看 | 欧美一区二区二区 | 中文字幕在线免费视频 | 日韩精品一区二区三区中文在线 | 国产精品免费观看视频 | 国产精品1区| 成人小视频在线观看 | 黄色大片在线播放 | 欧美一级片在线播放 | 成人毛片在线观看 | 日韩色视频 | 免费在线观看av | 老妇激情毛片免费 | 81精品国产乱码久久久久久 | 国产不卡视频在线 | 日韩国产欧美在线观看 |