Question: ListPopupWindow menu popup animation direction from left to right


ListPopupWindow menu popup animation direction from left to right

Answers 2
Added at 2017-01-01 12:01

I have a ListPopupMenu with code as below

public void showPopupMenu(View view) {
    ListPopupWindow listPopupWindow = new ListPopupWindow(getActivity());
    listPopupWindow.setAdapter(new CollectionItemMenuAdapter(getActivity(), popupMenuList));
    listPopupWindow.setWidth((int) getResources().getDimension(R.dimen.menu_width));
    listPopupWindow.setVerticalOffset((int) getResources().getDimension(R.dimen.menu_vertical_offset));
    listPopupWindow.setHorizontalOffset((int) getResources().getDimension(R.dimen.menu_horizontal_offset));


The result is as below, when click on the setting (in the gif, the first one), the popup menu appear.

enter image description here

However the menu animation appears from Right to Left. I would prefer it to show from Left to Right (like appearing from the setting button). Could I achieve that without creating a custom animation for it?

p/s: I tried custom animation using listPopupWindow.setAnimationStyle(...), also not working

Answers to

ListPopupWindow menu popup animation direction from left to right

nr: #1 dodano: 2017-01-01 12:01

I made in this way.

First, make animation set in res/anim folder

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android=""
   <scale android:fromXScale="0" android:fromYScale="1"
      android:toXScale="1" android:toYScale="1"

second, add style in res/values/styles.xml

<style name="Animation">
    <item name="android:windowEnterAnimation">@anim/animation</item>

and use setAnimationStyle.


This is PopupWindow. but i think they are both the same way.

good luck !!

nr: #2 dodano: 2017-01-01 14:01

Apparently my problem is mainly due to sending the wrong view over to listPopupWindow.setAnchorView(view);. I need to send the "setting-image" view instead of the "parent-list-view".

By sending the right view, I now have the animation starting from the right source i.e. the point of the setting image. The fixed animation is shown below enter image description here

Source Show
◀ Wstecz