-
-
Save codeforfun-jp/098e02efcfb8a0b6f0fa45bcebadc0bb to your computer and use it in GitHub Desktop.
Android Studio AlertDialog Customize - Java
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
public class MyDialogFragment extends DialogFragment { | |
@NonNull | |
@Override | |
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { | |
/* 省略 */ | |
} | |
@Override | |
public void onStart() { | |
super.onStart(); | |
AlertDialog alertDialog = (AlertDialog) getDialog(); | |
if (alertDialog != null) { | |
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.WHITE); | |
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setBackgroundColor(getResources().getColor(R.color.orange)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment