I have to show a dialog like a bottom sheet with animation for that I have used the following code.
View view = getLayoutInflater().inflate(R.layout.layout_picker_bottom_sheet, null);
Dialog mBottomSheetDialog = new Dialog(this, R.style.MaterialDialogSheet);
mBottomSheetDialog.setContentView(view);
mBottomSheetDialog.setCancelable(true);
mBottomSheetDialog.getWindow().setLayout(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
mBottomSheetDialog.getWindow().setGravity(Gravity.BOTTOM);
mBottomSheetDialog.show();
Dialog style
<!-- Bottom sheet style-->
<style name="MaterialDialogSheet" parent="@android:style/Theme.Dialog">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowIsFloating">false</item>
<item name="android:windowAnimationStyle">@style/MaterialDialogSheetAnimation</item>
</style>
<!-- Animation-->
<style name="MaterialDialogSheetAnimation">
<item name="android:windowEnterAnimation">@anim/popup_show</item>
<item name="android:windowExitAnimation">@anim/popup_hide</item>
</style>
And it works well but overlapping the navigation bar when entering with windowEnterAnimation
and it's placing in the desired position after the animation, nothing problem with that.
How can I start the animation of dialog from the navigation bar without overlapping it when entering?
You can see the UI below it's placing correctly but when coming out it animates over navigation.