简体   繁体   中英

I there way to get contact icon placeholder from phone book or else in Android?

I need to retrieve contact placeholders with letters and colored background (Not photo just placeholder like in screenshot). Is there a way to get one from contacts or maybe through some google API?

https://i.stack.imgur.com/Bm8pI.jpg

  1. try this code

     <LinearLayout android:id="@+id/ll_circle_color" android:layout_width="50.0dip" android:layout_height="50.0dip" android:background="@drawable/circle_green" android:gravity="center"> <TextView android:id="@+id/tv_class_circle_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="2" android:textColor="@android:color/white" android:textStyle="bold" /> </LinearLayout>

In drawable -

 <?xml version="1.0" encoding="utf-8"?>
 <shape android:shape="oval"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="@color/colorPrimary" />
</shape>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM