把一个activity作为弹窗

  1、可以在这个activity的xml中设置其高度为某个固定高度

  2、在java中:getWindow().setGravity(Gravity.BOTTOM);//设置在底部出现

          getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);//设置这个activity显示的高度

  3设置出现动画:

    在res中新建anim包,再新建push_bottom_in.xml:

  <?xml version="1.0" encoding="utf-8"?>
  <set xmlns:android="http://schemas.android.com/apk/res/android">
   <translate
   android:duration="500"
   android:fromYDelta="100%p"
   android:toYDelta="0" />
  </set>
  4、为这个acticity设置style

    <style name="AnimBottom" parent="@android:style/Animation">
     <!--底部动画风格-->
      <item name="android:windowEnterAnimation">@anim/push_bottom_in</item>
    </style>

原文地址:https://www.cnblogs.com/judes/p/5807975.html