First the scenario:
I have a list where each item has a photo of a contact and some text. I would like to click on the image and bring up the QuickContactBadge
. Badge is defined by the following XML snippet
<QuickContactBadge android:layout_height="wrap_content"
android:layout_width="wrap_content" android:id="@+id/badge"
android:layout_alignParentBottom="true"></QuickContactBadge>
What I tried and failed:
- Define one reusable badge and reuse it for all cases. Both list and badge are placed into
RelativeLayout
- Have one badge defined per each list item. The item uses
RelativeLayout
What do I see:
Basically nothing. The code gets valid badge instance and then I apply the following logic
contactPhoto.setOnClickListener(new OnClickListener() {
@Override
public void onClick(final View v) {
Log.d(TAG, "Image click");
if (badge != null) {
badge.assignContactFromEmail("johndoe@gmail.com", true);
badge.setMode(ContactsContract.QuickContact.MODE_SMALL);
badge.bringToFront();
}
}
});
As I click I can step through the code in onClick
handler yet the badge never comes up
The questions:
- Does
QuickContactBadge
have any placement logic? When I click on the image do I need to calculate badge position and readjust or is it built-in? - Is it possible to achieve what I describe above (badge for images displayed in the list) and what I'm doing wrong (or missing)