private void showTip() {
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
dialog.setPositiveButton("确定", (dialog1, which) -> dialog1.dismiss());
AlertDialog alertDialog = dialog.create();
TextView title = new TextView(this);
title.setText("提示");
title.setPadding(10, 30, 10, 10);
title.setGravity(Gravity.CENTER);
title.setTextSize(18);
title.setTextColor(Color.BLACK);
alertDialog.setCustomTitle(title);
alertDialog.setMessage("怎么一到周末,都没MM来约我呢?\r\n" +
"五四运动都快90年了,还搞得这么保守。她们怎么越来越不长进了呢?\n" +
"再看看一千多年前的唐朝,那时的女装多前卫,多时尚。真是一代不如一代,一代不如一代啊。\n" +
"一个早上我都在长吁短叹中度过!");
alertDialog.setCancelable(false);
alertDialog.show();
Button button = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
LinearLayout.LayoutParams cancelBtnPara = (LinearLayout.LayoutParams) button.getLayoutParams();
//设置按钮的大小
cancelBtnPara.height = LinearLayout.LayoutParams.WRAP_CONTENT;
cancelBtnPara.width = LinearLayout.LayoutParams.MATCH_PARENT;
//设置文字居中
cancelBtnPara.gravity = Gravity.CENTER;
//设置按钮左上右下的距离
cancelBtnPara.setMargins(100, 20, 100, 20);
button.setLayoutParams(cancelBtnPara);
// button.setBackground(ContextCompat.getDrawable(this, R.drawable.ic_launcher_background));
button.setTextColor(ContextCompat.getColor(this, R.color.white));
button.setTextSize(16);
}