Android 中的 QuickContactBadge 或弹出窗口
我的活动中有一个自定义列表视图。列表的每个项目的左侧都有图像按钮。我想在单击按钮时显示弹出窗口。弹出窗口有一些图像按钮,例如聊天消息。 我想要一个像单击 QuickContactBadge 时那样的弹出窗口。 我该怎么做? 我可以使用 QuickContactBadge(列出我自己的联系人而不是手机的联系人)吗? 有什么帮助吗....?
There is a custom listview in my activity. Each item of list has image button at the left hand side. I want to show popup window when button is clicked. And popup window has some image buttons like chat message.
I want a popup window like when QuickContactBadge is clicked.
How can I do this?
and can I use QuickContactBadge (In list my own contacts not phone's contact)?
Any help....?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过扩展
Dialog
并放置您自己的自定义View 里面有你喜欢的任何按钮。
更新:
我刚刚(直观地)检查了 QuickContactBadge。您的情况的问题是如何正确定位它,以便它指向用户单击的正确列表视图项目。可能的解决方案:
将现有的列表视图布局放入
FrameLayout
中,并在其上放置一个空的AbsoluteLayout
。当listview项被点击时,计算坐标并绘制AbsoluteLayout
中的QuickContactBadge
位于右侧坐标,以便它指向单击的项目。从未尝试过这个,所以我不知道它的效果如何:使用
ExpandableListView
单击时会展开该项目。在此展开的项目中,您可以显示QuickContactBadge
或仅显示您希望的一些按钮。就我个人而言,我会选择第二种方法。
You can create a custom dialog by extend a
Dialog
and putting your own customView
inside it with any buttons that you like.Update:
I just checked (visually) the QuickContactBadge. The problem in your case will be how to properly position it so that it will so that it will point to the correct listview item that user clicked. Possible solutions:
Put your existing listview layout inside a
FrameLayout
and put an emptyAbsoluteLayout
over it. When listview item is clicked, calculate the coordinates and drawQuickContactBadge
in theAbsoluteLayout
at the right coordinates so that it would point to the clicked item. Never tried this so I don't know how well this would work:Use
ExpandableListView
which expands the item when clicked. In this expaned item you could show theQuickContactBadge
or just some buttons that you wish.Personally, I'd go with 2nd approach.