Chrome-like display of menu

2019-05-19 23:35发布

问题:

I'm trying to find some information on how to create a menu that looks like the top of the menu for chrome for Android. I have tried experimenting with implementing icons for Android 4.0, but no luck. Tried googeling, but the only thing i found was an answer that said icons can't be implemented when API >= 11.

How does Chrome do it then? It's made for devices that's 4.0+!

回答1:

Use popup list window to achieve this. As you can add header and footer to any list, you can create one linear layout with back forward and star like options.. Add that view to the popup window.



回答2:

Any ListView can be associated with HeaderViewListAdapter, using this you can attach seperate layouts as a header and or footer to your listViews.

As Vinodkumar said, you can also use ListPopupWindow with HeaderViewListAdapters.

In the Android reference: HeaderViewListAdapter and ListPopupWindow