QuickContactBadge or Popup window in android
-
29-10-2019 - |
题
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....?
解决方案
You can create a custom dialog by extend a Dialog
and putting your own custom View
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.