0
I found on the net several tutorials in English with examples of methods to round up a bitmap image. However, I could not implement them within a Fragment. How to proceed in this case?
0
I found on the net several tutorials in English with examples of methods to round up a bitmap image. However, I could not implement them within a Fragment. How to proceed in this case?
3
In my case I only managed to use a make one ImageView round using an external library, in my case the Circleimageview.
Just add dependency on Gradle: 
compile 'de.hdodenhof:circleimageview:2.0.0'
And use CircleImageView in place of ImageView in xml: 
<de.hdodenhof.circleimageview.CircleImageView
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="96dp"
    android:layout_height="96dp"
    android:src="@drawable/profile" // Sua imagem
    app:civ_border_width="0dp" // Se quiser pode colocar uma borda na imagem tambem
    app:civ_border_color="#FF000000"/> // Cor da borda
For more information see the official link to API.
1
Good night,
I tried using android.support.v4.widget.Circleimageview, but could not, so one solution I found was to implement my own class (Mycircleimageview) inherited from Imageview. It is a very simple and small class. It can be used instead of Imageview in the layout.
/**
 * Created by jorlane on 15/05/17.
 */
public class MyCircleImageView extends ImageView {
private Paint paint;
...
Construtores (inicialização, cria o objeto paint)
... 
@Override
public void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    paint.setStrokeWidth(2);
    paint.setColor(Color.WHITE);
    paint.setStyle(Paint.Style.STROKE);
    float largura = getWidth();
    float altura  = getHeight();
    float x = largura / 2;
    float y = altura / 2;
    float raio = 0;
    if (largura > altura) {
        raio = (altura)/2;
    } else {
        raio = (largura) / 2;
    }
    canvas.drawCircle(x, y, raio, paint);
    paint.setStrokeWidth(300);
    canvas.drawCircle(x, y, raio + 150, paint);
}
Browser other questions tagged android android-fragment imageview
You are not signed in. Login or sign up in order to post.
Excuse my ignorance because I am beginner in java and android. But when downloading this library I must first paste it somewhere in my correct project? Where do I do this?
– mahenrocha
Use the Androidstudio?
– Bruno Romualdo
Yes. Exactly.
– mahenrocha
Just click build.Radle (Module: app) in the left corner of the screen, and add the line 'de.hdodenhof:circleimageview:2.0.0' in dependencies
– Bruno Romualdo
Right. But I don’t need to download the library that passed me the link and paste somewhere in my project or just add this line?
– mahenrocha
This line is like a link to the library, when adding it, will appear a yellow message at the top of the screen written Sync now, just click it (with internet, because it downloads once) and ready.
– Bruno Romualdo
Oh I get it. Okay. Thanks friend.
– mahenrocha