直播平台搭建,更改按钮文字默认大写的设置
更改底部按钮默认大写的设置
<style name="CustomAlertDialog" parent="@style/Theme.AppCompat.Light.Dialog.Alert">
<item name="buttonBarButtonStyle">@style/CustomAlertDialogButton</item>
</style>
<style name="CustomAlertDialogButton" parent="Widget.AppCompat.Button.ButtonBar.AlertDialog">
<item name="textAllCaps">false</item> <!--关闭默认大写的设置 -->
</style>
//最后通过构造函数将样式传进去
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.CustomAlertDialog);
底部按钮为三个时,三个按钮居中
//默认情况下:
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.CustomAlertDialog);
AlertDialog dialog = builder.setTitle("My Title")
.setMessage("My Message")
.setPositiveButton("Positive", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
showToast("Positive");
}
}).setNeutralButton("Neutral", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
showToast("Neutral");
}
}).setNegativeButton("Negative", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
showToast("Negative");
}
}).create();
dialog.show();
以上就是 直播平台搭建,更改按钮文字默认大写的设置,更多内容欢迎关注之后的文章
标签:DialogInterface,AlertDialog,直播,大写,dialog,按钮,new,默认 From: https://www.cnblogs.com/yunbaomengnan/p/17593286.html