Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class DialogTest extends DialogFragment {
- private Context mContext;
- public static DialogTest newInstance() {
- return new DialogTest();
- }
- @Override
- public Dialog onCreateDialog(Bundle savedInstanceState)
- {
- final Dialog dialog = super.onCreateDialog(savedInstanceState);
- dialog.getWindow().getAttributes().windowAnimations = R.style.FragmentDialogAnim;
- return dialog;
- }
- @Override
- public void onCreate(@Nullable Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- mContext = getContext();
- setStyle(DialogFragment.STYLE_NORMAL, R.style.AppTheme);
- }
- @Nullable
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
- View view = inflater.inflate(R.layout.dialog_test, container, false);
- return view;
- }
- @Override
- public void onStop() {
- super.onStop();
- if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P) {
- getDialog().getWindow().setWindowAnimations(-1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement