0

I am trying to set a SVG Icon as the background of an Android ImageView. The SVG Icon will receive some padding and colors are being changed a little.

    <ImageView
        android:id="@+id/passwordLabel"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:background="@android:color/black"
        android:padding="30px"
        android:tint="@android:color/white"
        app:srcCompat="@drawable/ic_lock"
        tools:layout_editor_absoluteX="16dp"
        tools:layout_editor_absoluteY="524dp" />

Is there a way to make the ImageView circular now? I have tried other solutions but am confused, as they demand me to change the background.

JVS
  • 2,592
  • 3
  • 19
  • 31

2 Answers2

1
Hasan Khan
  • 554
  • 1
  • 7
  • 23
1

You can't make the imageView circular, because it just displayed the image that already set.

  1. Use CircleImageView library instead
  2. Wrap your ImageView with CardView and make the radius half of its width/height
  3. Change your image shape to be circle instead
alhamwa
  • 79
  • 5