New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
show as anchor from center #7
Comments
Did you show up using below method? .showAtCenter(View anchor); or .showAtCenter(View layout, 0, 0); |
I am also getting the same issue. I have a button at center of the screen, on button click i want to show popup menu. Button is also the anchor view i want popup to appear at button/anchor's center, but popup menu always show/align at left edge of button. By using .showAtCenter(View anchor); It appear at center but does not appear above the anchor view. I want it to appear above and center of the anchor view |
In that case, need to set xOffset and yOffset. final Button button = findViewById(R.id.button2);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
hamburgerMenu.showAsDropDown(view, view.getMeasuredWidth()/2, -view.getMeasuredHeight()/2);
}
}); Use the showAsDropDown view to set the position in relation to the anchor view. |
@skydoves this does not worked in my case
But to manipulate positions using xOffset and yOffset i need popupwindow width/height but i couldn't access it using your API. So i have now setWith(popupWidth) and then calculated the position like this
Thanks |
@egek92 @nomizodiac below method is added at v2.0.3 .showAsAnchorCenter(View anchor); and it looks more nature using with .setAnimation(MenuAnimation.SHOW_UP_CENTER) |
I have a view that has width of match_parent it's also my view anchor, I want toshow my pop-up from this view's center but it either show up from left or right
The text was updated successfully, but these errors were encountered: