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

EditText 中的 setHintTextColor()

setHintTextColor() in EditText(EditText 中的 setHintTextColor())
本文介紹了EditText 中的 setHintTextColor()的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我有一個(gè)視圖,其中有兩個(gè)文本框,用戶可以從同一屏幕上的另一個(gè)視圖中選擇文本顏色(通過對(duì)話框).

I have View in which there are two text boxes, and the user can select text color from another view on the same screen (through dialog box).

因此,當(dāng)用戶通過對(duì)話框更改顏色時(shí),我正在更改 EditText 文本及其提示的顏色.但是,當(dāng)用戶選擇其他顏色后 EditText 中有一些文本可用時(shí),該文本將以該顏色出現(xiàn).但是,如果我刪除所有這些文本,那么 HintText 的顏色就是以前的顏色.

So when the user changes color via dialog box, I am changing color of EditText text and its hint. But when there is some text is available in EditText after that user selects other color, then that text is coming in that color. But if I remove all that text then the color of HintText is that of the previous color.

例如,當(dāng)前如果我在文本框中有紅色并且用戶選擇綠色,那么文本是綠色的.但是,如果我刪除該文本,那么即使我在代碼中更改提示顏色,提示文本也會(huì)變?yōu)榧t色.僅當(dāng)那里有一些文本時(shí)才會(huì)出現(xiàn)此問題.如果它是空白的并且有提示文本,那么問題就不會(huì)出現(xiàn).

For example, currently if I have red color in text box and the user selects green color so text is there in green color. But if I remove that text then hint text are coming in red even if I change hint color in code. This problem only comes when there is some text there. if it is blank and hint text is there then problem is not coming.

推薦答案

使用它來改變提示顏色.-

Use this to change the hint color. -

editText.setHintTextColor(getResources().getColor(R.color.white));

解決您的問題 -

editText.addTextChangedListener(new TextWatcher() {
    @Override
    public void onTextChanged(CharSequence arg0, int arg1, int arg2,int arg3){
        //do something
    }

    @Override
    public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
        //do something
    }

    @Override
    public void afterTextChanged(Editable arg0) {
        if(arg0.toString().length() <= 0) //check if length is equal to zero
            tv.setHintTextColor(getResources().getColor(R.color.white));
    }
});

這篇關(guān)于EditText 中的 setHintTextColor()的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nè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 中檢測向左或向右滑動(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ù)值?)
主站蜘蛛池模板: 亚洲精品视频在线播放 | 超碰精品在线观看 | 国产精品一区二区在线播放 | a视频在线 | 久久精品亚洲一区二区三区浴池 | 国产一区二区a | 日韩一区二区精品 | 精品视频一区二区三区 | 青青草网站在线观看 | 欧美日韩精品一区二区 | 91在线网 | 99这里只有精品视频 | 看片天堂| 在线观看黄免费 | 欧美一区二区三区视频 | 99久9| 亚洲国产精品99久久久久久久久 | 第一av| 欧美日韩黄色一级片 | 黄网站涩免费蜜桃网站 | 免费在线一区二区 | 久久精品中文字幕 | 欧美色综合 | 国产激情91久久精品导航 | 免费中文字幕日韩欧美 | 日本福利视频 | 给我免费的视频在线观看 | 欧美色综合| 97色在线视频 | 久久精品国产一区 | 美女激情av | 久久精品国产亚洲 | 欧美日韩视频在线第一区 | 丁香久久| 黄色大片免费播放 | 亚洲三区在线观看 | 日本午夜在线视频 | 精品久久久久久国产 | 在线播放一区二区三区 | 九九国产在线观看 | 91大片|