简体   繁体   中英

how to load a image to ImageView src using piccaso android studio

i am loading an image from firebase storage using Picasso

Picasso.get().load(obj.P_URI).into(profile);

image lost its out line

it seem that it loaded into background i want it to load into src how can i do this XML below

    <androidx.cardview.widget.CardView
    android:id="@+id/cardView_profile_id"
    android:layout_width="@dimen/_45sdp"
    android:layout_height="@dimen/_45sdp"
    android:layout_marginStart="@dimen/_10sdp"
    android:layout_marginTop="@dimen/_10sdp"
    android:elevation="5dp"
    app:cardCornerRadius="360dp"
    app:layout_constraintEnd_toStartOf="@+id/home_name_id"
    app:layout_constraintBottom_toTopOf="@+id/home_HorizontalScrollView_id"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <ImageView
        android:id="@+id/home_profile_id"
        android:layout_width="@dimen/_43sdp"
        android:layout_height="@dimen/_43sdp"
        android:layout_gravity="center"
        android:background="@drawable/bg_circle"
        android:clipToOutline="true"
        android:outlineProvider="background"

        />

</androidx.cardview.widget.CardView>

i want image load like this

i just wanted the outline for circle profile and same time want to load image from the url it seem that Picasso can not load image into scr. changing xml to this way fixed my problem. hope this will help someone

XML

    <androidx.cardview.widget.CardView
    android:id="@+id/cardView_profile_id"
    android:layout_width="@dimen/_65sdp"
    android:layout_height="@dimen/_65sdp"
    android:backgroundTint="#51CDC9"
    android:elevation="5dp"
    android:layout_marginTop="@dimen/_10sdp"
    app:cardCornerRadius="360dp"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/imageView">

    <ImageView
        android:id="@+id/singup_profile_id"
        android:layout_width="@dimen/_63sdp"
        android:layout_height="@dimen/_63sdp"
        android:layout_gravity="center"
        android:background="@drawable/default_profile_icon"
        android:clickable="true"

        />

    <ImageView
        android:id="@+id/profileRing_id"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:background="@drawable/bg_circle_edge" />


</androidx.cardview.widget.CardView>

in drawable bg_circle_edge

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

<stroke android:width="@dimen/_2sdp"/>
<stroke android:color="@color/white"/>
<corners android:radius="@dimen/_360sdp"/>
<corners android:radius="360dp"/>

</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