简体   繁体   English

关于Android View的问题

[英]Question about Android View

First off I'm new to owning an android and trying to develop android apps. 首先,我不熟悉拥有一个android并尝试开发android应用。 I've noticed that sometimes in applications and in the local android apps that sometimes when you a long press or sometimes just tap a menu comes up. 我注意到,有时在应用程序和本地android应用程序中,有时长按或有时只是轻按菜单会出现。 This menu isn't like a context menu bc there is no title. 此菜单与上下文菜单不同,因为bc没有标题。 Just a white list of options, and in others it seems to be completely custom but once again no Black Bar title on top of it. 只是选项的白名单,而在其他选项中,它似乎是完全自定义的,但再次没有黑条标题。 If anyone knows the name of this view could you let me know. 如果有人知道该视图的名称,您可以告诉我。 Thanks 谢谢

It's in fact a context menu... the only difference is that it does not have a title. 实际上,这是一个上下文菜单……唯一的区别是它没有标题。 Take a look at the registerForContextMenu . 看一下registerForContextMenu

You are right ContextMenus are shown on long presses only. 您是对的ContextMenus仅在长ContextMenus显示。 Everything else you saw is either a Dialog or a custom view. 您看到的其他所有内容都是Dialog或自定义视图。 You define menus like described in the android developer articles: http://developer.android.com/guide/topics/ui/menus.html 您可以定义菜单,如android开发人员文章中所述: http : //developer.android.com/guide/topics/ui/menus.html

If you want to completely customize some sort of menu you could also just use a Dialog and add every view element you want. 如果要完全自定义某种菜单,也可以使用Dialog并添加所需的每个视图元素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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