久久久久久久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 中的數值?)
主站蜘蛛池模板: 国产在线精品免费 | 中国91av| 五月香婷婷 | a级片播放 | 欧美大片一区 | 中文字幕视频网 | 美女艹b | 亚洲欧洲视频 | 亚洲网在线| 国产超碰人人爽人人做人人爱 | 天天在线操| 国产精品一区免费 | 久久黄网 | 日韩激情一区 | 国产精品免费小视频 | 国产乱码一二三区精品 | 国产亚洲一区精品 | 电影在线 | 欧美日韩综合 | 拍拍无遮挡人做人爱视频免费观看 | 亚洲精品久久久久久久久久久 | 日朝毛片| 亚洲精品在线91 | 日韩欧美视频免费在线观看 | www97影院| 一级片在线免费播放 | www.久久久 | 亚洲精品一区二区三区蜜桃久 | 国产传媒在线播放 | 亚洲第一福利网 | 亚洲综合首页 | 日本成人二区 | 在线播放中文字幕 | 日韩一二三区视频 | 99久久国产免费 | 国产视频一二三区 | 国产美女特级嫩嫩嫩bbb片 | 久久天堂网 | 日韩在线欧美 | 欧美日韩不卡合集视频 | 日韩久久精品 |