如何显示从窗口小部件QuickContact卡 [英] How to display QuickContact card from widget

查看:137
本文介绍了如何显示从窗口小部件QuickContact卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个显示我的一些接触的画面窗口小部件,我想,以显示QuickContact卡,当用户点击的图片之一。我知道我应该使用方法ContactsContract.QuickContact.showQuickContact(),但它需要一个视图或矩形作为输入参数之一。我的问题是小工具只有RemoteViews,所以我不知道是怎么传的视图或矩形参数。任何想法将AP preciated。

I have a widget that displays the picture of some of my contacts and I would like to display the QuickContact card when the user taps on one of the pictures. I know I should be using the method ContactsContract.QuickContact.showQuickContact(), but it requires a View or a Rect as one of the input parameters. My problem is that Widgets only have RemoteViews, so I'm no sure what to pass as the View or Rect parameter. Any ideas would be appreciated.

推荐答案

您可以参考该徽章在XML

You can reference the badge in the XML

我有这样的XML文件中:

I have this in the XML file:

     <QuickContactBadge
     android:id="@+id/photo"
    android:layout_width="54dip"
    android:layout_height="57dip"
    android:layout_marginLeft="5dip"
    android:background="@drawable/quickcontact_photo_frame"
    style="?android:attr/quickContactBadgeStyleWindowSmall"
     />

这code:

and this code:

private QuickContactBadge mPhotoView;
mPhotoView = (QuickContactBadge) findViewById(R.id.photo);
mPhotoView.assignContactUri(objItem.getUri());
mPhotoView.setMode(QuickContact.MODE_MEDIUM);

这是调用模式(但胸卡上点击正在处理这个弹出,这个调用也弹出选择器可以通过点击别的制造)

and this is the calling mode (but the click on the badge is handling this popup, this call too popup the chooser is made by clicking on something else)

QuickContact.showQuickContact(viewContactQuick.this, mPhotoView,objItem.getLookupUri() , QuickContact.MODE_MEDIUM, null);

这篇关于如何显示从窗口小部件QuickContact卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆