My usecase is to edit shapeAppearanceModel for com.google.android.material.card.MaterialCardView
card.shapeAppearanceModel = card.shapeAppearanceModel
.toBuilder()
.setTopEdge(TriangleEdgeTreatment(triangleSize))
.build()
Above code is working as expected But due to above programatically setup of shapeAppearanceModel
xml
<com.google.android.material.card.MaterialCardView
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardBackgroundColor="?myCustomColor"
app:cardCornerRadius="8dp"
app:cardElevation=4dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="false">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@drawable/myImageDrawable"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</com.google.android.material.card.MaterialCardView>
In Android studio as the TopEdge is define programatically Editor is not replicating the bug but in Emulator/Real device the child is not getting clipped and The Rounded Corners are getting overlapped by ImageView.
And when i remove the shapeAppearanceModel setup the clipping work's
as expected.
ScreenShot
question from:
https://stackoverflow.com/questions/65889328/why-setting-shapeappearancemodel-in-materialcardview-stops-childclipping 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…