Last active
September 17, 2022 13:17
-
-
Save mediavrog/9345938 to your computer and use it in GitHub Desktop.
Android Compatibility popup menu with icons (requires support library v7)
@miankhalid Did you found a work around. MenuBuilder and MenuPopupHelper both are now restricted to LIBRARY_GROUP
Seems like the only way to use it currently is through reflection https://resocoder.com/2018/02/02/popup-menu-with-icons-android-kotlin-tutorial-code/
Thank you! Works perfectly! Heads up for those using appcombat v7:23.1.1 and up, they changed the packages slightly.
import android.support.v7.view.SupportMenuInflater; import android.support.v7.view.menu.MenuBuilder; import android.support.v7.view.menu.MenuPopupHelper; import android.support.v7.view.menu.MenuPresenter; import android.support.v7.view.menu.SubMenuBuilder;
Just remove .internal from there :)
And now, you replace import android.support.v7
with androidx.appcompat
import androidx.appcompat.view.menu.MenuBuilder;
import androidx.appcompat.view.menu.MenuPopupHelper;
import androidx.appcompat.view.menu.MenuPresenter;
import androidx.appcompat.view.menu.SubMenuBuilder;
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Support v7
MenuPopupHelper
is now hidden and restricted to LIBRARY_GROUP 😢More details here:
https://stackoverflow.com/questions/44969577/support-v7-menupopuphelper-is-now-hidden-and-restricted-to-library-group