0

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....?

Khushbu Shah
  • 1,603
  • 3
  • 27
  • 45

1 Answers1

1

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:

  1. Put your existing listview layout inside a FrameLayout and put an empty AbsoluteLayout over it. When listview item is clicked, calculate the coordinates and draw QuickContactBadge in the AbsoluteLayout 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:

  2. Use ExpandableListView which expands the item when clicked. In this expaned item you could show the QuickContactBadge or just some buttons that you wish.

Personally, I'd go with 2nd approach.

Peter Knego
  • 79,991
  • 11
  • 123
  • 154
  • but I need background of dialog like QuickContactBadge popup. – Khushbu Shah Sep 12 '11 at 10:15
  • Is it possible using [PopupWindow](http://developer.android.com/reference/android/widget/PopupWindow.html) ? – Khushbu Shah Sep 12 '11 at 10:37
  • This is similar to 1st approach, without a FrameLayout/AbsoluteLayout hassle. I never tried it, but it looks as it should work. – Peter Knego Sep 12 '11 at 10:42
  • @Khushbu: Instead of a popup window you can do it using a layout that is set visible on tapping any listitem. You can pull the QCB's background resource from the Contacts app in android source. – Ron Sep 12 '11 at 11:08