Display FB profile pic in circular image view in Application

后端 未结 7 1179
刺人心
刺人心 2020-11-29 06:21

I am trying to get the profile pic of a user from FB and display it in a circular image on my app.I am able to retrieve and display the display pic in ProfilePictureView wid

相关标签:
7条回答
  • 2020-11-29 06:56

    You can adapt gusridd answer with some PNG file (with transparency in the middle) using FrameLayout approach. Instead of using vector (API +21), drawable/subtracted_circle will be a file at res/drawable/subtracted_circle.png. Even tough you need to generate this file, you can use any shape you want. You also need to use the same color of your background in the picture.

    <FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentTop="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true">
    
    <com.facebook.login.widget.ProfilePictureView
        android:id="@+id/profile_picture"
        android:layout_width="160dp"
        android:layout_height="160dp"></com.facebook.login.widget.ProfilePictureView>
    
    <ImageView
        android:id="@+id/android"
        android:layout_width="160dp"
        android:layout_height="160dp"
        android:src="@drawable/subtracted_circle"
        android:contentDescription="@null" />
    
     </FrameLayout>
    

    res/drawable/subtracted_circle.png

    0 讨论(0)
提交回复
热议问题