Android Studio 左側のプロジェクト構造からパッケージ名(com.example.sample)を選択した状態で右クリックして、New → Kotlin Class/File を選択します。
MyDialogFragment と入力して Enter キーを押します。
5 行目の : DialogFragment() を追加します。
2. ダイアログを作成する
ダイアログは2種類のデザインがあります。
AlertDialog
MaterialAlertDialog
まずは普通の AlertDialog を作成してみましょう。
onCreateDialog メソッドを追加して、以下のようにダイアログを作成します。
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
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
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
COMMENT
投稿いただいたコメントは管理者の承認後に表示されます。
コードやエラーに関するご質問の場合は、以下の3点
をできるだけ具体的に必ず書いてください。