java 用于调整mergin的对话框示例
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java 用于调整mergin的对话框示例相关的知识,希望对你有一定的参考价值。
public class DialogUtils {
public static void showOkButtonDialog(Context context, String message) {
View view = LayoutInflater.from(context).inflate(R.layout.view_alert_dialog, null, false);
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(context);
builder.setView(view);
android.app.AlertDialog alert = builder.create();
ColorDrawable back = new ColorDrawable(android.graphics.Color.TRANSPARENT);
InsetDrawable inset = new InsetDrawable(back, 100);
alert.getWindow().setBackgroundDrawable(inset);
TextView txtText = view.findViewById(R.id.tv_dialog_content);
txtText.setText(message);
TextView button = view.findViewById(R.id.tv_dialog_positive);
button.setOnClickListener(v -> alert.dismiss());
alert.show();
}
}
以上是关于java 用于调整mergin的对话框示例的主要内容,如果未能解决你的问题,请参考以下文章