Kalaivani R
Kalaivani R

Reputation: 357

Background Black color showing in circular Imageview

I have designed circularimageview when I run the application and I am facing issues with black background around the circular image in my layout, How to fix this issue.

xml file

<de.hdodenhof.circleimageview.CircleImageView
            android:id="@+id/gs_image_userProfileimage"
            android:layout_width="80dp"
            android:layout_height="80dp"
            app:civ_border_color="#95c764"
            app:civ_border_width="2dp"

            app:civ_shadow_radius="3" />

Java coding:

 gs_image_userProfileimage=(ImageView)view.findViewById(R.id.gs_image_userProfileimage);

     Picasso.with(getContext())
      .load(gs_var_userimage)
      .placeholder(R.drawable.getspot_logo)
       .into(gs_image_userProfileimage);

I tried to give setLayout (view.Layout_Hardware) even though its showing the same thing.

Upvotes: 3

Views: 2408

Answers (4)

Travis Whitten
Travis Whitten

Reputation: 64

If you have a View or Layout widget behind the Circular Image then you must set the Tint to transparent like so:

<de.hdodenhof.circleimageview.CircleImageView
     android:id="@+id/gs_image_userProfileimage"
     android:layout_width="80dp"
     android:layout_height="80dp"
     app:civ_border_color="#95c764"
     app:civ_border_width="2dp"
     android:backgroundTint="@android:color/transparent"
     app:civ_shadow_radius="3" />

Example: The Problem

Fixed

Upvotes: 1

Kamal Bunkar
Kamal Bunkar

Reputation: 1452

You can simple set the background color of circular ring.

app:civ_circle_background_color="@color/blue_background"

Upvotes: 2

user4571931
user4571931

Reputation:

define your image view background like below code ..

    <de.hdodenhof.circleimageview.CircleImageView
    android:id="@+id/gs_image_userProfileimage"
    android:layout_width="80dp"
    android:layout_height="80dp"
    app:civ_border_color="#95c764"
    app:civ_border_width="2dp"
    android:background="@color/white"
    app:civ_shadow_radius="3" />

change only this

    android:background="@color/white"

Upvotes: 1

Navneet Krishna
Navneet Krishna

Reputation: 5017

try changing the imageview type as CircleImageView

It should be declared as

de.hdodenhof.circleimageview.CircleImageView gs_image_userProfileimage;

then use like this

gs_image_userProfileimage=(de.hdodenhof.circleimageview.CircleImageView)view.findViewById(R.id.gs_image_userProfileimage);
gs_image_userProfileimage.setLayerType(View.LAYER_TYPE_HARDWARE, null);

Upvotes: 1

Related Questions