-
-
Save codingwithsara/fc33612baaebbef686454d7fdb48b3a1 to your computer and use it in GitHub Desktop.
AlertDialog Customize 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// タイトル | |
TextView titleView = new TextView(this); | |
titleView.setText("タイトル"); | |
titleView.setTextSize(24); | |
titleView.setTextColor(Color.WHITE); | |
titleView.setBackgroundColor(getResources().getColor(R.color.alertBlue)); | |
titleView.setPadding(20, 20, 20, 20); | |
titleView.setGravity(Gravity.CENTER); | |
AlertDialog dialog = new AlertDialog.Builder(this) | |
.setCustomTitle(titleView) | |
.setMessage("ここにメッセージを入力します。ここにメッセージを入力します。ここにメッセージを入力します。") | |
.setPositiveButton("OK", new DialogInterface.OnClickListener() { | |
@Override | |
public void onClick(DialogInterface dialog, int which) { | |
// OK が押された時の処理を書く | |
} | |
}) | |
.show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment