How to set a title for a context menu?
When I bring开发者_运维百科 up the context menu on a contact in the Android built-in app, the context menu has a title (the contact's name). Same for playlist context menu in the Music app.
I have added a context menu to an ImageView (no list item). There is no title, just the options are shown. Is there an easy way to set a title so that my context menu looks like the built-in apps' ones?
You want to use setHeaderTitle(CharSequence title).
精彩评论