Skip to content

Instantly share code, notes, and snippets.

@codeforfun-jp
Created December 21, 2023 00:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeforfun-jp/9ebc79df8eb9d0a28a0502f6e533ca79 to your computer and use it in GitHub Desktop.
Save codeforfun-jp/9ebc79df8eb9d0a28a0502f6e533ca79 to your computer and use it in GitHub Desktop.
Android Studio AlertDialog Customize - Kotlin
class MyDialogFragment : DialogFragment() {
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
/* 省略 */
}
override fun onStart() {
super.onStart()
(dialog as AlertDialog).getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.WHITE)
(dialog as AlertDialog).getButton(AlertDialog.BUTTON_POSITIVE).setBackgroundColor(resources.getColor(R.color.orange))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment