这是我创建对话框的代码,
builder.setMessage(msg).setNeutralButton("Dismiss",dialogClickListener)
.setPositiveButton("Edit", dialogClickListener)
.setNegativeButton("Delete", dialogClickListener).show();
Run Code Online (Sandbox Code Playgroud)
是否可以用蓝色而不是红色显示解雇?
首先,从构建器创建 AlertDialog:
AlertDialog dialog = builder.create();
Run Code Online (Sandbox Code Playgroud)
然后你可以找到你的按钮并改变颜色:
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);
Run Code Online (Sandbox Code Playgroud)
这里你使用下一个方法:
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.
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8490 次 |
最近记录: |