【发布时间】:2019-10-14 00:18:30
【问题描述】:
我在AlertDialog 中有一个EditText,而底线颜色不是我想要的,我不知道如何更改它。
这是我目前所拥有的。
AlertDialog.Builder adb = new AlertDialog.Builder(new ContextThemeWrapper(MainActivity.this, R.style.EditTextAlertDialog));
adb.setTitle("Title");
inputET = new EditText(this);
inputET.setInputType(InputType.TYPE_CLASS_TEXT);
inputET.setTextColor(getResources().getColor(android.R.color.white));
inputET.setHighlightColor(getResources().getColor(android.R.color.white)); //This should change it, but it's not.
adb.setView(inputET);
adb.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
adb.show();
由于某些奇怪的原因不起作用,应该是setHightlightColor。
【问题讨论】:
-
试试这个:
editText.getBackground().setColorFilter(getResources().getColor(R.color.your_color), PorterDuff.Mode.SRC_ATOP); -
谢谢迪内什!现在我只需要弄清楚如何让占位符颜色发生变化。
-
我的意思是光标颜色
标签: java android material-design android-alertdialog