skydoves / PowerMenu

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

invalid height #47

Closed MrOplus closed 2 years ago

MrOplus commented 5 years ago

Please complete the following information:

Describe the Bug:

When list has only one child and has a header it shows only the header the list item exists under overflow part (scrolls) setting manual height wont work at all

Expected Behavior:

menu should shows at least some items but it shows only header

*edit 1 : setting Height wont work at all

  PowerMenu.Builder builder = new PowerMenu.Builder(this)
                .setHeaderView(R.layout.servers_header)
                .setAnimation(MenuAnimation.SHOW_UP_CENTER) // Animation start point (TOP | LEFT).
                .setMenuRadius(10f) // sets the corner radius.
                .setMenuShadow(10f) // sets the shadow.
                .setTextColor(getResources().getColor(R.color.colorAccent))
                .setSelectedTextColor(Color.WHITE)
                .setMenuColor(Color.WHITE)
                .setLifecycleOwner(this)
                .setWidth(mHomeLayout.getMeasuredWidth() - 100)
                .setHeight(mHomeLayout.getMeasuredHeight())
                .setOnMenuItemClickListener(onServerMenuClicked());
            for(int i = 0 ; i < length ; i++){
                builder.addItem(new PowerMenuItem("Server #" + String.valueOf(i),false));
            }
            mServersMenu = builder.build();
            mServersMenu.showAsAnchorCenter(mHomeLayout);

setting height to any number wont affect the height at all

image

skydoves commented 5 years ago

@kooroshh Hi, thank you for your issue. Here is the example for using header with items. It seems to check mHomeLayout.getMeasuredHeight() size is zero or not.

MrOplus commented 5 years ago

measured height is 1395 the provided sample shows only the header (if it has only one list item) image