popupWindow = new PopupWindow(popupwindow的布局,
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, true);
popupWindow.setBackgroundDrawable(new BitmapDrawable());
popupWindow.setAnimationStyle(R.style.PopupAnimation);
int publicbenefitxoffInPixels = imgbtn_toaction.getWidth() / 2;
popupWindow.showAsDropDown(imgbtn_toaction,
-publicbenefitxoffInPixels, 0);
popupWindow.update();
R.style.PopupAnimation代码:
<style name="PopupAnimation" parent="android:Animation">
<item name="android:windowEnterAnimation">@anim/popup_enter</item>
<item name="android:windowExitAnimation">@anim/popup_exit</item>
</style>