1 activity的 onCreate
/不加的话,无法填满布局/
getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
2 activity finish后添加
否则退出的效果不理想
overridePendingTransition(0, 0);
样式文件
<style name="AppDialogFullBottom" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowIsTranslucent">true</item>
<!--半透明背景-->
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowCloseOnTouchOutside">false</item>
<!--false会显示出标题来-->
<item name="android:windowIsFloating">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowAnimationStyle">@style/bottom_anim</item>
</style>
<style name="bottom_anim">
<item name="android:windowEnterAnimation">@anim/push_bottom_in</item>
<item name="android:windowExitAnimation">@anim/push_bottom_out</item>
</style>
<!-- push_bottom_in -->
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="200"
android:fromYDelta="100%"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromXDelta="0%"
android:toXDelta="0%"
android:toYDelta="0"
/>
</set>
<!-- push_bottom_out -->
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="200"
android:fromXDelta="0%"
android:fromYDelta="0"
android:interpolator="@android:anim/decelerate_interpolator"
android:toXDelta="0%"
android:toYDelta="100%" />
</set>
对应的actiivty在清单文件中 使用AppDialogFullBottom样式
网友评论