Reputation: 83
I'm trying to apply corner radius to a MaterialCardView . The corner radius displays correctly in the XML layout editor, but when I run it on an emulator or a physical device, it doesn’t seem to take effect.
Here’s an image for reference:
Here’s the relevant code:
Profile Image Code:
<com.google.android.material.card.MaterialCardView
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_gravity="center"
android:layout_marginTop="20sp"
android:layout_marginBottom="10dp"
app:cardCornerRadius="80dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/model1" />
</com.google.android.material.card.MaterialCardView>
Stats Layout Code:
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp"
app:cardCornerRadius="40dp"
android:layout_weight="1"
android:backgroundTint="@color/grey"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/grey"
android:padding="50dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Overall"
android:layout_gravity="start"
android:textColor="@color/white"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="@+id/overall_score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:textColor="@color/white"
android:textSize="50sp"
android:textStyle="bold" />
</LinearLayout>
<ProgressBar
android:id="@+id/overall_score_progress_bar"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="10dp"
android:layout_gravity="bottom"
android:max="100"
android:layout_marginBottom="35dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp" />
</com.google.android.material.card.MaterialCardView>
Can anyone help me out with this
Upvotes: 1
Views: 64
Reputation: 83
I removed this lines in my Manifest file and after that my cardviews are worked prefectly fine
android:hardwareAccelerated="false"
Upvotes: 1