简体   繁体   中英

Popup menu with Material Design 2

I have a Popup menu that I create like this:

val popup = PopupMenu(this, more_button) 
popup.menuInflater.inflate(R.menu.menu_options, popup.menu) 
popup.setOnMenuItemClickListener(this) 
popup.show()

But I can't seem to find how to create a Popup with that round corners edges like the new Google Chrome have for the "more button" on the right upper corner.

How do I create a Popup menu based on the new Material Design 2?

Update

With the new com.google.android.material:material:1.1.0-alpha03 and Theme.MaterialComponents theme, all PopupMenu will have Mateiral Design2 look. When material-1.1.0 is out, we'll have them all.🎉

Old Answer

How do I create a Popup menu based on the new Material Design 2?

There is a third-party library MaterialPopupMenu .

Google has planned to create all material components but it seems that takes a long time.

BTW, Google Chrome creates the popup menu manually. The round corner is simply a .9.png file. code and popup_bg

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM