视频直播源码,标题居中,底部按钮为三个时居中布局
更改底部按钮默认大写的设置
<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/17748972.html