Circular Image View with a background

circular imageview android without library
circular imageview android tutorial
android circle imageview programmatically
circular view android
rounded corner imageview android library
how to make imageview rounded
circular imageview with text android
how to add round image view in android

It came weird but i am very confused in that one .I need to download user profile pic like below image . I have the outside Background as png . But i am so confused how i can achieve this one . If any knows a better and optimized solution please rectify it here. I need that the downloaded image will cover inner white part only .

share with you

public class MyCircleImageView extends ImageView {

private  Paint paint;

public MyCircleImageView(Context context, AttributeSet attrs) {
    super(context, attrs);
    paint = new Paint();

protected void onDraw(Canvas canvas) {

   Drawable drawable = getDrawable();
    if (drawable != null && drawable instanceof BitmapDrawable)
        BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;

        Bitmap bitmap = bitmapDrawable.getBitmap();
        int bitmapWidth = bitmap.getWidth();
        int bitmapHeight = bitmap.getHeight();
        int minR = (bitmapHeight<bitmapWidth?bitmapHeight:bitmapWidth)/2;
        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));

 //            canvas.drawBitmap(bitmap,0,0,paint);
        Rect srcRect = new Rect(0,0,bitmapWidth,bitmapHeight);
        Rect dstRect = new Rect(bitmapWidth/2-minR,0,bitmapWidth/2+minR,bitmapHeight);




    }else {

ImageView in circular through xml, Adding Border to round ImageView - LATEST VERSION. Wrap it with another CardView slightly bigger than the inner one and set its background colour to add a  How to set circular background color in CircleImageView. We often need to set the background colour of an image and for that we use. 1. ImageView.setBackgroundColor(color); But in case of CircleImageView, when we use setBackgroundColor() function it sets the background colour in a quadrilateral shape.

Here, You need two things circleimageview + background(blue image).

If you want best result for all devices then set-background with blue image and according to device give border_width to Cirlceimageview so you can get imageview like above.

       android:src="@mipmap/profile" //user profile
       android:background="@mipmap/njvkf" //Blue image

Add Cirlceimageview class you can see result of above code snippet

dependencies {
        compile 'de.hdodenhof:circleimageview:2.1.0'

How to make a Circular Image View in Android without Third-Party , The image below represents the circular image view in the android We use this RelativeLayout to apply the background as drawable.xml for  A simple circular image view can be made with white border and transparent content with shape without using any library. Below are steps on how to do so: Step 1: Creating the layout of the circular image view Create a new drawable resource file in the drawable directory which defines the shape of image view that is a circle.

You can use: app:civ_fill_color

    android:src="@drawable/car" />

How to set background color for the Circle View? · Issue #64 , Setting the background color, colors the whole image view. How do I only color the circle view? In this tutorial, we are going to see how to create a circular image view and a circular image view with border-color in Android. Most of the time the android developers use a third-party library for creating a circular profile image, but this tutorial will explain how to create a circular image view without the help of the third-party library and plugins as well.

CardView Corner Radius, and remove its corner radius ( "cornerRadios = 0dp" ). The image below represent a circular and rounded corner ImageView in android application. We will first create a class that we can use to change or adjust the amount of rounded corner we wanted in our ImageView. This class can be use to create both circular and rounded corner ImageView.

hdodenhof/CircleImageView: A circular ImageView for , A circular ImageView for Android. Contribute to Add support for elevation; Add circle background color attribute to replace fill color. 2.1.0. Add support for  Set the stroke cap for the border around the circle. Set the border around the circle. Sets the radius of the circle to be a percentage of the largest dimension of the view. Sets the radius of the circle to be a percentage of the largest dimension of the view when pressed.

how to get background circle for a transparent image? : androiddev, Can somebody help me in creating a background circle wrapping an image? <​ImageView android:layout_width="@dimen/drawer_header_portrait"  This is an Android project allowing to realize a circular ImageView in the simplest way possible. USAGE. To make a circular ImageView add CircularImageView in your layout XML and add CircularImageView library in your project or you can also grab it via Gradle:

  • Possible duplicate of ImageView in circular through xml
  • Well thx for reply .The circular Image view i know .but how can i make the right bottom arrow part
  • take a look at this: its not exactly the same but basic idea is the same. They use a 9-Patch image.
  • This question is 2 years old . And your answer will not work you see that triangle thing on right bottom .
  • Generally, answers are much more helpful if they include an explanation of what the code is intended to do, and why that solves the problem without introducing others.