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

EditText 中的 setHintTextColor()

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

問(wèn)題描述

我有一個(gè)視圖,其中有兩個(gè)文本框,用戶可以從同一屏幕上的另一個(gè)視圖中選擇文本顏色(通過(guò)對(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)用戶通過(guò)對(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)此問(wèn)題.如果它是空白的并且有提示文本,那么問(wè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.

推薦答案

使用它來(lái)改變提示顏色.-

Use this to change the hint color. -

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

解決您的問(wèn)題 -

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)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(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ù)值?)
主站蜘蛛池模板: 久久国产精品视频 | 99r在线 | 久久综合欧美 | 亚洲免费人成在线视频观看 | 欧美一a | 国产精品久久久久一区二区 | 麻豆av电影网 | 国产天天操 | 久久69精品久久久久久久电影好 | 人人人干 | 久久久久国产精品 | 久久狠狠| 日日射影院 | 国产福利91精品一区二区三区 | 亚洲国产一区二区三区在线观看 | 国产视频第一页 | 精品国产乱码久久久久久蜜臀 | 午夜成人免费视频 | 精品国产一区二区久久 | 日韩中文不卡 | 国产小网站 | 中文字幕第九页 | 日韩一区二区三区在线视频 | 日韩精品一区二区三区中文字幕 | 一区二区三区欧美大片 | 日韩国产精品一区二区三区 | 视频一区在线观看 | 综合国产| 夜夜爽99久久国产综合精品女不卡 | 中文字幕在线一区二区三区 | 国产免费一区二区三区 | 男人的天堂在线视频 | 欧美区在线 | av一区二区三区四区 | 人人爽日日躁夜夜躁尤物 | 国产欧美日韩久久久 | 欧美一区二区三区在线播放 | 国产伦精品一区二区三区在线 | 男女黄网站 | 99精品视频免费在线观看 | 在线一区视频 |