问题标签 [android-contextmenu]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
android - 关于Flurry的一些问题
您好,我正在我的应用程序中实施 Flurry 广告和分析。我的应用程序具有复杂的活动结构,其中包括 tabhost、tabgroup、上下文菜单、选项菜单和许多其他东西。
在实施过程中,我想到了几个问题,并且无法让混乱正常工作。
所以,我的问题是——
如何查看收到的广告的来源网络(appcircle、admob、InMobi 等)?或者哪个广告网络投放当前广告?
如何获取当前的活动会话数?
如何测试单个广告网络(appcircle、admob、InMobi 等)是否正常工作并成功投放广告?
有没有人用不同的广告网络实施乱舞广告?如果是,请您提供这些网络的清单数据。
为什么上下文对 FlurryAgent 如此重要(混乱与上下文混淆)?它不能是全局的(ApplicationContext)而不是本地的(ActivityContext)。
java - 在 ContextMenu 中获取表格行数据
好吧,所以我一直在努力通过浏览帖子来解决这个问题,但我还没有遇到任何可行的东西。
这是我的表格代码的一部分:
和上下文菜单:
所以基本上我需要在选定的(长按并打开上下文菜单)表行中获取文本视图中的值。
有什么想法和建议吗?
非常感谢您的帮助!
android - Triggering a PopupMenu with buttons inside a ListView item
Types of Menu
Let me start by outlining the distinction between Contextual Menus and Popup Menus (taken from here):
A PopupMenu is a modal menu anchored to a View
A contextual menu [I'm talking specifically about floating context menus] offers actions that affect a specific item or context frame in the UI. You can provide a context menu for any view, but they are most often used for items in a ListView, GridView, or other view collections in which the user can perform direct actions on each item.
As guidance, the docs distinguish between their uses: - PopupMenu: "Providing an overflow-style menu for actions that relate to specific content (such as Gmail's email headers..." - ContextualMenu: "For actions that affect selected content..."
I'm after the visual look and interaction of the PopupMenu.
My setup (and goal)
I have a ListView where each item has a button on the right.
while retaining the onItemClick
for each ListItem, I'd like to leverage the button to trigger a PopupMenu
.
The actions in the PopupMenu
are listed in my_menu.xml
, so the only difference between each instance of the menu is the item that it was clicked for.
What I've tried
I've tried overriding getView()
in my ListAdapter
to add an OnClickListener
for each button, as per this post. The result was inconsistent; not all the clicks were registering (perhaps due to recycling - I haven't tried this fix yet) but in general the approach seemed squiffy, considering the ease of specifying a context menu for a listview.
I've also tried adding a contextual menu, which was dead easy, except that it's only triggered when the list item is long-pressed.
Is the getView()
method the way to go or is there something easier?
In my listview, I've a mini overflow button for each item, similar to each track in playlist for Play Music. They display a PopupMenu for each item there, when you click on the overflow button. Long-press does nothing.
I'd like that but not sure how? The menu page only elaborates how to enable a popup menu for individual views.
registerForContextMenu(ListView lv)
is the only thing I've seen that I can apply to an entire ListView, but that seems to only work on long-presses of the entire list. Is there a way to hook that event to a click of a specific view in a list item (whilst still maintaining the list item click for the rest of the list item)?
I've tried setting an onClickListener
in getView()
as described here but it feels squiffy for PopupMenu, and not all clicks were registering every time (it was consistently inconsistent).
Update - with getView() overridden again
When I create the StacksCursorAdapter, I pass an instance of StackViewFragment which is stored as a field (so it can be assigned to views as the click listener).
ViewHolder
is a class with public final ImageView miniOverflow
StacksCursorAdapter (extends SimpleCursorAdapter):
StackViewFragment (extends ListFragment, implements View.OnClickListener):
stack_list_item.xml:
The issue at this junction is that I have to click several times occasionally to get the click to register (on the button). This is without scrolling, so it's not related to view recycling.
Concluding (solution by eskimoapps.com marked as correct)
So there was no issue with the multiple clicks except that my touch target was not in the place I was expecting - the image asset I was using for the mini overflow is weighted to the right (such that the three dots are near the right edge of the touch target) meaning that I was just missing it half the time (facepalm).
Overriding getView()
as I showed above seems to work fine, and in fact, getView()
can be modified even further, by setting the OnClickListener only if it's needed (but definitely, updating the tag needs to be done for every view, not just the newly created ones):
android - 如何使用列表视图适配器中的单击按钮打开菜单上下文 Android?
如何使用列表视图适配器中的单击按钮打开菜单上下文 Android?
我尝试了我的代码,但没有显示菜单上下文,
代码
你能告诉我,它应该如何工作?
android - 选择多个项目时动态隐藏上下文操作栏 (CAB) 中的项目
我有一个 listActivity 在长按时显示 CAB。如果选择了超过 1 个项目,我想隐藏我的一个菜单项。
我跟踪在 中选择的项目数onItemCheckedStateChanged()
。但是,我无权访问菜单以从此功能中删除该项目。请参阅下面代码中的注释以了解我在尝试什么。我觉得我缺少一些简单的核心理解......下面的代码是从我的onCreate()
函数中调用的。
还有我的菜单项...
android - 如何在junit中测试上下文操作栏
我正在寻找在 JUnit 中测试上下文操作栏菜单。
- 我想测试一下菜单是否正确。
- 检查与菜单项关联的可绘制对象和文本是否正确。
- 启动项目。
如何找到要触摸的菜单项?是否像膨胀菜单并找到菜单项并执行TouchUtils.clickView(this, view);
. 我不确定。
java - Android上下文菜单未出现
我的问题就像它在描述中所说的那样,上下文菜单没有出现在用户的“触摸并按住”上。我有一种感觉,它可能是我放置的地方registerForContextMenu
。
这是我的主要活动:
java - 我的 ContextMenu 中有一个简单的错误,有人可以解决吗?
我正在尝试使上下文菜单适用于项目列表,如下所示,但我不确定在单击项目时如何链接到列表名称。>>>>> 行是我认为我错了。有人可以看看我做错了什么吗?这是我的 Main_Acitivty:
android - 将项目从 ContextMenu 保存到数据库中
我被这个问题困住了,我不能再进一步了。所以我希望有人可以在这里帮助我。
问题 我有一个 ContextMenu 和 onLonghold 我想将 ListView 中的项目添加到本地数据库中。但是对象是这样的数组
我怎么能这样:
所以我可以将每个字符串添加到数据库中的右列中吗?
这是我到目前为止所拥有的
android - 片段中的上下文动作模式 - 如果不集中则关闭?
我在嵌套片段中实现了上下文操作模式栏。这个片段是视图分页器的一部分,视图分页器也是一个片段和导航抽屉的一部分。
我的问题:如果片段不再集中,我想关闭上下文操作模式栏。因此,如果我在视图寻呼机中滑动,操作模式栏应该关闭。但是如果我使用onPause()
嵌套片段的方法,则不会直接调用该方法。通常它会等到我向前滑动两到三下......这里有一些图片:
在第二张图片中,您可以看到操作模式栏仍然存在。所以我的问题是:如果我离开片段,我应该在哪个方法中调用我的actionModeBar.finish()
方法,直接关闭动作模式栏?
也许片段的代码可以帮助您: