我有一个listview,可以通过QuickContactBadge获取联系信息,但是没有出现QuickContactBadge所在的位置。我该怎么做?
适配器创建:
String[] fields = new String[] {
ContactsContract.Data.PHOTO_ID,
ContactsContract.Data.DISPLAY_NAME,
ContactsContract.Data.PHOTO_ID
};
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.contract_list_entry, cursor,
fields, new int[] {R.id.contactEntryPicture, R.id.contactEntryName, R.id.contactEntryAmount});
Listview项目:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout1" android:layout_width="match_parent">
<QuickContactBadge android:id="@+id/contactEntryPicture" android:layout_height="54dp" android:layout_width="54dp"></QuickContactBadge>
<LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout2" android:layout_width="wrap_content" android:orientation="vertical">
<TextView android:id="@+id/contactEntryName" android:layout_width="wrap_content" android:text="TextView" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_height="wrap_content"></TextView>
<TextView android:layout_width="wrap_content" android:text="TextView" android:textAppearance="?android:attr/textAppearanceSmall" android:layout_height="wrap_content" android:id="@+id/contactEntryAmount"></TextView>
</LinearLayout>
</LinearLayout>
</LinearLayout>
答案 0 :(得分:0)
在您的字段数组中,您有两次PHOTO_ID。你的意思是这样做吗?