The direction of the Android listpopupwindow menu pop-up animation is from left to right
                                        
                    •
                    Android                                    
                I have a listpopupmenu with the following code
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.setHeight(WRAP_CONTENT);
    listPopupWindow.setVerticalOffset((int) getResources().getDimension(R.dimen.menu_vertical_offset));
    listPopupWindow.setHorizontalOffset((int) getResources().getDimension(R.dimen.menu_horizontal_offset));
    listPopupWindow.setAnchorView(view);
    listPopupWindow.show();
}
The results are as follows. When you click settings (first in GIF), a pop-up menu is displayed
However, the menu animation is displayed from right to left. I want it to be displayed from left to right (just like the setting button). Can I implement it without creating a custom animation for it?
P / s: I tried to customize the animation using listpopupwindow.setanimationstyle (...) and it didn't work
resolvent:
That's what I did
First, animate in the RES / anim folder
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
   <scale android:fromXScale="0" android:fromYScale="1"
      android:toXScale="1" android:toYScale="1"
      android:duration="700"
      />
</set>
Second, add styles to RES / values / styles.xml
<style name="Animation">
    <item name="android:windowEnterAnimation">@anim/animation</item>
</style>
And use setanimationstyle
popupWindow.setAnimationStyle(R.style.Animation);
This is popupwindow. But I think they are all the same
Good luck!!
                            The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
                        
                                            
                        THE END
                    
                    
                    
                                                        二维码
                        
                        
                                                
                        