2

を使おうとしていQuickContactBadgeます。私はこのような効果を得たいと思っています:

しかし、このコードを書くと:

QuickContactBadge badge = (QuickContactBadge) findViewById(R.id.badge_small);  
badge.assignContactFromPhone("831-555-1212", true);  

バッジは表示されませんが、連絡先ページにリダイレクトされます。

これがlayout.xmlです:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <QuickContactBadge
        android:id="@+id/badge_small"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/icon" />
</LinearLayout>  

バッジを表示するにはどうすればよいですか?

4

2 に答える 2

2

AndroidManifest.xml ファイルに READ_CONTACTS 権限を追加する必要があります。

<uses-permission android:name="android.permission.READ_CONTACTS" />
于 2011-09-29T03:00:34.593 に答える
0

1) A caution: you must use API Level 5 or above to use this function.

2) For taking to you on contact page: The function of this badge works in such a way that if a contact is already there then it will show you the quick contact badge else it will take you the "add contact" screen with this phone no pre filled in contact's info.

So now, you need to save a contact with the phone no defined. After saving the contact, when you will click on the button next time, it will show you the desired results.

于 2011-04-04T09:52:45.617 に答える