Android and android Official Website
Window_in.xml
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" > <translate android:duration="500" android:fromXDelta="0" android:fromYDelta="1000" android:toXDelta="0" android:toYDelta="0" /> </set>
Window_out.xml
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" > <translate android:duration="500" android:fromXDelta="0" android:fromYDelta="0" android:toXDelta="0" android:toYDelta="1000" /> </set>
Configure the animation to the style
<style name="main_menu_animstyle"> <item name="android:windowEnterAnimation">@anim/settingswindow_in_anim</item> <item name="android:windowExitAnimation">@anim/settingswindow_out_anim</item> </style>
Apply an animation to Dialog
Window window = dialog. getWindow (); // sets the display animation window. setWindowAnimations (R. style. main_menu_animstyle); WindowManager. layoutParams wl = window. getAttributes (); wl. x = 0; wl. y = getWindowManager (). getdefadisplay display (). getHeight (); // set the display position dialog. ondeskwattributeschanged (wl); // you can click "disband dialog. setCanceledOnTouchOutside (true); dialog. show ();
I am the dividing line of tiantiao
Refer to github: https://github.com/pinguo-yuyidong/Study_Demos/tree/master/BottomMenu