I have strange problem.
I have Activity inherite from AppCompatActivity with Fragment inside.
In this Fragment I show DatePickerDialog to select date.
A declared Activity in manifest.xml as
<activity name=".SampleActivity" android:configChanges="keyboardHidden|orientation|screenLayout|screenSize" />
now.
I want to show DatePickerDialog inside Fragment so I created custom DatePickertFragment with code:
public class DatePickerFragment extends AppCompatDialogFragment{
// (...)
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
DatePickerDialog dialog = new DatePickerDialog(getActivity(), this, year, month, day);
return dialog;
}
// (...)
}
and execute show() method inside fragment
pickerFragment.show(getChildFragmentManager(), null);
I run show picker code inside onClick() method. DatePicker shows correctly.
And now is problem.
Dialog show correctly in portrait screen orientation but when I rotate screen to landscape mode dialog seems to be cut on left and right size.
I checked and I suppose that Dialog picker didn't change layout orientation on screen rotate.
Screenshots below
1. Portrait orientation, correct dialog

- Next I rotate device and in landscape mode I getting something like cut dialog (landscape dialog layout in dialog portrait layout dimensions)

I changed manifest.xml Activity declaration to
android:configChanges="keyboardHidden|orientation"
And now is work correctly but I can't do this, because other app part will work incorrect.
So I wonder if I can invalidate or redraw DialogPicker to resize it boundaries after I rotate screen?