使用PopupWindows
主要参考资料:
http://www.cnblogs.com/noTice520/archive/2011/08/16/2140356.html
http://www.cnblogs.com/and_he/archive/2011/08/12/2136107.html
1. style 的使用
res/anim/ 这目录可以创建动画的xml配置文件
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true"
>
<translate android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:fromYDelta="0"
android:toYDelta="100"
android:duration="1000"
android:fillEnabled="true"
android:fillAfter="true"
/>
<alpha
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="1000"
/>
</set>
res/values/style.xml 可以配置不同的样式
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="buttonstyle">
<item name="android:background">#ff00ffff</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">#ff00ffff</item>
<item name="android:textSize">18sp</item>
</style>
<style name="popupwindow">
<item name="@android:windowEnterAnimation">@anim/in</item> ------------->这里应用上面的动画文件
<item name="@android:windowExitAnimation">@anim/out</item>
</style>
<style name="a">
<item name="@android:windowEnterAnimation">@anim/grow_from_topleft_to_bottomright</item>
<item name="@android:windowExitAnimation">@anim/shrink_from_bottomright_to_topleft</item>
</style>
</resources>