I have a CardView aligned to the top of the screen. Inside the CardView, there is an ImageView and I just want to adjust the height of the right-hand side of the CardView just like in the image below. Is this possible?
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintWidth_percent="1"
app:layout_constraintHeight_percent="0.4"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:cardElevation="10dp"
app:cardCornerRadius="0dp">
<ImageView
android:id="@+id/bngCover"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srcCompat="@drawable/explore2"
android:scaleType="centerCrop"/>
</androidx.cardview.widget.CardView>
Asides the radius, CardViews are usually rectangular in nature; therefore, this cannot be easily achieved with a CardView.
Best advice would be to create your own resource file. This way, you can define how exactly you want your view to look and still give it the properties you want (elevation, radius, etc).
To learn how to create a drawable resource file, check this tutorial out. You can also read up on the Android documentation on ShapeDrawables here.