The elevetaion isn't showed for TextView. Here is a layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".presentation.TrainingListFragment">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/schedule_label"
style="@style/Widget.AppCompat.TextView"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/background_selector"
android:elevation="15dp"
android:fontFamily="@font/inter_medium"
android:gravity="center_horizontal|center_vertical"
android:outlineProvider="none"
android:text="@string/schedule"
android:textColor="@color/black"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_list_of_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="65dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/schedule_label"
tools:listitem="@layout/list_of_days_item" />
</androidx.constraintlayout.widget.ConstraintLayout>
And this is my background selector for TextView:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/bottom_bar_background" />
<corners android:radius="5dp" />
</shape>
I tried all advices from Elevation on Android Lollipop not working and from here Android "elevation" not showing a shadow
I can't figure out what the reason is. Your advices?!
I solved the issue, when I set background shape selector with color different from white.