I'm trying to create a Button with two backgrounds, my custom background
android:background="@drawable/background_profile_edit_button" + ?attr/selectableItemBackground```
Full button:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/fragprofile_constraint"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:background="@drawable/background_profile_edit_button"
android:paddingStart="32dp"
android:paddingTop="6dp"
android:paddingEnd="32dp"
android:paddingBottom="6dp"
android:text="Edit Profile"
android:textColor="@color/colorBlackFont"
android:textSize="12sp"
android:textStyle="bold"/>
This can be easily fixed with android:foreground="?attr/selectableItemBackground"
however that requires api 23 and my min is 19.
I have also tried another approach using layer-list in my drawable:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
android:shape="rectangle">
<solid android:color="@color/colorWhite" />
<stroke
android:width="1dp"
android:color="@color/dividerColor" />
<corners android:radius="3dp"/>
</shape>
</item>
<item
android:drawable="?attr/selectableItemBackground">
</item>
</layer-list>
This layerlist works perfectly on my higher API devices. However it's causing a crash on my API 19 device...
android.view.InflateException: Binary XML file line #201: Error inflating class TextView
This person also has had the same problem and it's also unanswered:
LayerList error API 19: tag requires a 'drawable' attribute or child tag defining a drawable
TLDR:_______________________________________________________
Doing this on a API 19 Device