本文介绍了安卓:奇怪的行为在QuickContactBadge的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好我想要使用QuickContactBadge;我想获得这样的效果:
Helloi'm trying to use the QuickContactBadge; i would like to get an effect like this:
但是当我写这篇code:
but when i write this code:
QuickContactBadge badge = (QuickContactBadge) findViewById(R.id.badge_small);
badge.assignContactFromPhone("831-555-1212", true);
我不明白的徽章,但我重定向到联系人页面。
I don't see the badge but i am redirected to the Contact page.
下面是layout.xml:
Here is layout.xml:
<?xml version="1.0" encoding="utf-8"?>
<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"></QuickContactBadge>
</LinearLayout>
我怎么能看到的徽章?
How can i see the badge?
在此先感谢℃。
推荐答案
您需要将READ_CONTACTS允许添加到您的AndroidManifest.xml文件:
You need to add the READ_CONTACTS permission to your AndroidManifest.xml file:
<uses-permission android:name="android.permission.READ_CONTACTS" />
这篇关于安卓:奇怪的行为在QuickContactBadge的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!