skydoves / PowerMenu

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

Menu Padding & Icon Size #63

Open WenLonG12345 opened 4 years ago

WenLonG12345 commented 4 years ago

Hi, thanks for this awesome library! However, I got some question regarding to this library.

Can I know how to add padding on the menu?

skydoves commented 4 years ago

Hi, here is a solution now, but I will consider adding a new setPadding() function in the next release.

powerMenu.getMenuListView().setPadding(10, 10, 10, 10);

Thanks!

WenLonG12345 commented 4 years ago

Wow, I never expected a so fast response from you! A very big thank you to you and you works is superb! Looking forward to your future work 👍

WenLonG12345 commented 4 years ago

Hi, sorry to ask question again.

Can I know how to modify the icon size on PowerMenuItem?

skydoves commented 4 years ago

Hi, In the default menu, we cannot change the icon size now (but we can in a CustomPowerMenu). It seems to be added in the next release too. Thanks for sharing your issue :) I will let you know if the next version would be out.

WenLonG12345 commented 4 years ago

I will study the CustomPowerMenu and implement custom icon size. Once again, a very big thank you to you, skydoves! 🥇

skydoves commented 4 years ago

Hey, @WenLonG12345 It's released a new version 2.1.5. You can use setIconSize, setIconPadding, setIconColor, setPadding functions now. Thanks!

WenLonG12345 commented 4 years ago

I implemented it and all of it works well! Very thank you for your fast response and appreciate your works 👍

WenLonG12345 commented 4 years ago

image

Hi, another issue again is the icon padding, setIconPadding seems added padding for all direction, do you have any idea how to fix this?

skydoves commented 4 years ago

Hi, it's released a new version 2.1.6. Thank you for sharing your issues :)

WenLonG12345 commented 4 years ago

Hi, it's nice to hear from you again!

By the way, I am using

App Compat

instead of

MaterialComponent

I had forced to switch my primary theme into MaterialComponent and the powermenu works!

and also, I found that MaterialComponent actually provides me more nicer padding and rounded curve. Hence, I decided to switch to MaterialComponent and slowly migrate all my works into this awesome theme.

Thanks for your great work and it helps to solve my issue :) Thank you 👍

WenLonG12345 commented 4 years ago

Hi, it is me again.

I had implement the new method "setPadding()" and it works fine. However, after I implement setPadding(), the menu become scrollable.

I had test before and after applying setPadding() and I can confirm setPadding is the function that affect the scrolling behaviour. Is there any solution for this?

9a4c141d-2a39-4770-a153-1d1c55cb85bf

sosodennis commented 3 years ago

I also faced the same issue. Not only padding but setting the divider height. I think the menu height might not include such padding or divider height. Currently I use the following code as a fix: PowerMenu powerMenu; int menuDividerHeight = 3; PowerMenu.Builder menuBuilder = new PowerMenu.Builder(mContext); menuBuilder.setAnimation(MenuAnimation.DROP_DOWN); menuBuilder.setMenuRadius(menuRadiusPx); menuBuilder.setMenuShadow(menuShadowPx); menuBuilder.setTextSize(menuTextSizePx); menuBuilder.setWidth(estimatedMenuWidth); menuBuilder.setDividerHeight(menuDividerHeight); menuBuilder.setAutoDismiss(true); menuBuilder.setMenuColor(Color.BLACK); menuBuilder.setTextColor(Color.WHITE); menuBuilder.setOnMenuItemClickListener(mContext); menuBuilder.setTextGravity(Gravity.CENTER); menuBuilder.setLifecycleOwner(mContext); powerMenu = menuBuilder.build(); //Temporary fixing powerMenu.setHeight(powerMenu.getContentViewHeight() + menuDividerHeight);