I have an EditText
in an AlertDialog
and the bottom line color is not what I want, and I can't figure out how to change it.
Here is what I have so far.
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();
For some weird reason that is not working, setHightlightColor
should be it.
You can create a style for your dialog.
<style name="MyDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorAccent">@color/yourEditTextColor</item>
</style>
And then add it while creating your Dialog
AlertDialog.Builder adb = new AlertDialog.Builder(new ContextThemeWrapper(MainActivity.this, R.style.MyDialogTheme));
您需要为该用途设置背景色调:
inputET.setBackgroundTintList(ColorStateList.valueOf(intColorCode));
在xml文件下将它放入你的EditText: app:backgroundTint="@color/black"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.