![](/img/trans.png)
[英]Change TextInputLayout focused & unfocused hint color programmatically
[英]How to change the focused hint color(upper) of TextInputLayout according to specific conditions programmatically
您可以使用TextInputLayout
的setHintTextColor
function 根據您的喜好以編程方式更改提示顏色。
TextInputLayout textInputLayout = findViewById(R.id.textInputLayout);
int colorInt = getResources().getColor(R.color.red,getTheme());
ColorStateList colorStateList = ColorStateList.valueOf(colorInt);
textInputLayout.setHintTextColor(colorStateList);
這將改變提示 label 顏色,如下所示:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.