Here is my code:
input.xml (layout folder)
Try using images of different resolutions such as mdpi,hdpi,xhdpi if only using higher resolution images it might cause a crash in low resolution phones
for those who have this problem: there are some cases that may lead app to crash. I have seen these the most.
1- using ?selectableItemBackground may cause this problem.
2- if using large images (or else) that make the application errors like failed to allocate... this happens when hardware accelerated is on. you can set it to off in this case and using large-heap in manifest(application element)
3- if you have a drawable that is in v-21(for example) branch and you are running app on below 21, it can cause this problem too.
good luck!
My problem was that I had a shape with a <solid>
with color ?selectableItemBackground
. Yes it is dumb and a specific case, but posting it here for people with the same mistake.
Well, in my case the answer was in xml design, conflict android:backgroundTint and android:tint
I was design a FloatinActionButton like this:
<android.support.design.widget.FloatingActionButton
android:id="@+id/fa_close_patient"
android:layout_width="50dp"
android:layout_height="50dp"
android:scaleX="0.8"
android:scaleY="0.8"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_gravity="right"
android:layout_marginEnd="30dp"
android:backgroundTint="@color/white"
android:src="@drawable/ic_close_black_24dp"
android:tint="@color/colorPrimaryDark" />
and it's ok but API > 23
If u design for API_LEVEL < 23, this it's the fix
<android.support.design.widget.FloatingActionButton
android:id="@+id/fa_close_patient"
android:layout_width="50dp"
android:layout_height="50dp"
android:scaleX="0.8"
android:scaleY="0.8"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_gravity="right"
android:layout_marginEnd="30dp"
app:backgroundTint="@color/white"
android:src="@drawable/ic_close_black_24dp"/>
I hope I have help you,
Regards