0

i'm new in Android Studio. I want to ask, can i make ImageView with round corners programmatically? because i want use it to load data from database. So, user profile picture will be appear with rounded corner

this is what i want

my XML is below :

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="#F3FFFC">
    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <ImageView
                android:id="@+id/imgView"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:src="@drawable/profilepicture"
                />
        </LinearLayout>
    </ScrollView>
</LinearLayout>

Thank you for your time to read my question, hope i can solve this problem :D

1 Answers1

0
<androidx.cardview.widget.CardView
    android:layout_width="150dp"
    android:layout_height="150dp"
    app:cardCornerRadius="20dp">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/ic_launcher_background" />

</androidx.cardview.widget.CardView>

by using this dependency implementation 'androidx.cardview:cardview:1.0.0'

Abdur Rehman
  • 1,247
  • 10
  • 13