这是我创建对话框的代码,
builder.setMessage(msg).setNeutralButton("Dismiss",dialogClickListener)
.setPositiveButton("Edit", dialogClickListener)
.setNegativeButton("Delete", dialogClickListener).show();
是否可以用蓝色而不是红色显示解雇?
首先,从构建器创建 AlertDialog:
AlertDialog dialog = builder.create();
然后你可以找到你的按钮并改变颜色:
dialog.show(); //Only after .show() was called
dialog.getButton(dialog.BUTTON_NEGATIVE).setTextColor(your_color);
dialog.getButton(dialog.BUTTON_POSITIVE).setTextColor(your_color);
dialog.getButton(dialog.BUTTON_NEUTRAL).setTextColor(your_color);
这里你使用下一个method https://developer.android.com/reference/android/widget/TextView.html#setTextColor(int):
void setTextColor (int color)
Sets the text color for all the states (normal, selected, focused) to be this color.
Parameters
color int: A color value in the form 0xAARRGGBB. Do not pass a resource ID. To get a color value from a resource ID, call getColor.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)