1

私の要件は、画像付きの連絡先を1つ作成し、連絡先画像の横に連絡先の名前を表示することです。

以下に私のコードを示します。ここでも連絡先を作成できますが、正確な出力を取得できません。

コード:

<LinearLayout 

xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical" >

<QuickContactBadge

    android:id="@+id/quickContactBadge1"

    android:layout_width="wrap_content"

    android:layout_height="wrap_content" />

<TextView

    android:id="@+id/checkedTextView1"

    android:layout_width="wrap_content"

    android:layout_height="wrap_content"

    android:text="CheckedTextView" />

 </LinearLayout>

私の出力:

ここに画像の説明を入力してください

必要な出力:

ここに画像の説明を入力してください

誰かが私を提案してください。

ありがとう。

4

1 に答える 1

0

クイック コンタクト バッジには、いくつかのデータを入力する必要があります。円形の頭 + 笑顔のイメージは、データを適用していない場合に得られるものです。Uri を取得し、それをバッジに割り当てる必要があります。

Shane Conder と Lauren Darcey による素敵なチュートリアルがあります: http://mobile.tutsplus.com/tutorials/android/android-sdk_contact-badge/

以下は、チュートリアルのコード スニペットで、バッジを作成する方法を示しています。

Uri contactUri = data.getData();  
        FrameLayout badgeLargeHolder = (FrameLayout) findViewById(R.id.badge_holder_large);  
        QuickContactBadge badgeLarge = new QuickContactBadge(this);  
        badgeLarge.assignContactUri(contactUri);  
        badgeLarge.setMode(ContactsContract.QuickContact.MODE_LARGE);  
        badgeLarge.setImageResource(R.drawable.droid_small);  
        badgeLargeHolder.addView(badgeLarge);
于 2013-03-06T06:06:07.720 に答える