I am trying to achieve this look on my buttons. I have tried couple of things but none of them worked. My last solution is to create 9-patch images (one image for top-left light shadow layer, and another one for right-bottom dark shadow layer) and combining them within a draw-able resource file. Like this:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/solids">
<nine-patch android:src="@drawable/bottom" android:dither="false" />
</item>
<item android:id="@+id/solid">
<nine-patch android:src="@drawable/shadow1" android:dither="false" />
</item>
</layer-list>
But they are not fitting right. They look like this :/ Can anyone help me about it? Thanks a lot!
Edit: Also i need another 9-patch drawables for my cardviews. In my design, there is a card like this. I got details about this card from Adobe xd here, when i do it like exactly what it says, it is not fitting right. İt becomes like this How can i fix it?
Edit 2: This is my 9-patch file for the cardview. And here how i use it:
<androidx.cardview.widget.CardView
android:id="@+id/myCard"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="40dp"
app:cardCornerRadius="20dp"
app:layout_constraintEnd_toEndOf="@+id/card1"
app:layout_constraintHeight_percent="0.25"
app:layout_constraintHorizontal_bias="0.512"
app:layout_constraintStart_toStartOf="@+id/card1"
app:layout_constraintTop_toBottomOf="@+id/card1"
app:layout_constraintWidth_percent="0.90">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/myNinePatch"/>
</androidx.cardview.widget.CardView>
note: I am not a native speaker so i have tried to explain it best that i can.