skydoves / PowerMenu

:fire: Powerful and modernized popup menu with fully customizable animations.
Apache License 2.0
1.19k stars 175 forks source link

Wrong position in RecyclerView #5

Closed zenkhas closed 6 years ago

zenkhas commented 6 years ago

screenshot_1521524357

The menu is attached to the "Productive" TextView, it looks fine on other list items, but when clicked on the last shown item in list, it ties to expand into the space remaining below the item instead of top.

contextMenu.showAsDropDown(view, 0, 0);

skydoves commented 6 years ago

I didn't found any problems yet in RecyclerView. I tested on GithubFollows repository's __issue_powermenu__ branch.

https://github.com/skydoves/GithubFollows/tree/feature/issue_powermenu

please check in MainActivity's testMenu. Thank you for your issue!

zenkhas commented 6 years ago

screenshot_1521530481 It has the same problem too, if you click on the last "visible" item of the RecyclerView.

Can we make it ignore the Drop-Down behaviour when there is no space left and open up in upwards directions instead?

skydoves commented 6 years ago

it's fixed at v2.0.2. please check working well in your project!

try to use

setIsClipping(boolean enable)
zenkhas commented 6 years ago

screenshot_1521543066 @skydoves Thank you for your response buddy. Unfortunately it didn't fixed it either. Please find the screenshot above.

skydoves commented 6 years ago

I think the only way now to fix is using setHeight() method.

    private OnItemListener onItemListener = new OnItemListener() {
        @Override
        public void onClick(View view, String name) {
            hamburgerMenu.setHeight(600);
            hamburgerMenu.showAsDropDown(view, 0, 0);
        }
    };

It seems like a sdk bug and works differently by devices. In my case, Samsung Galaxy s5, s6, and s7 work well (auto-scrolling or positioning). but in s4 works strange and android studio's virtual machine is same. if I find other alternatives, I will get in touch with you. Thanks!

skydoves commented 6 years ago

@zenkhas sorry for late. it fixed at v2.0.3. and it looks better using with below animations.

.setAnimation(MenuAnimation.FADE)

or

 .setAnimation(MenuAnimation.NONE)

than just showAsDropdown