mikepenz/Android-Iconics

Question regarding FloatingActionButtons coloring.

jatsqi opened this issue · 2 comments

About this issue

Hey,
i have been using this awesome library for a while now and everything works pretty smoothly overall, but I ran into an issue when it comes to FloatingActionButtons.

The button looks like this:

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/button_edit_toggle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="16dp"
        android:layout_marginBottom="16dp"
        android:clickable="true"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent" />

The icon is set via Kotlin at runtime:

val icon = IconicsDrawable(requireContext(), OutlinedGoogleMaterial.Icon.gmo_android).apply {
            colorInt = Color.WHITE
            sizeDp = 50
        }
editToggleButton.setImageDrawable(icon)

The icon of the button still appears black, even though I set the color to white. Is this some limitation of the library when it comes to these drawables or did I something wrong here?
This scenario works perfectly fine with the IconicsImageView btw.

Details

  • [5.2.8] Used library version
  • Android Studio Emulator, API Level 30

Checklist

@jatsqi sounds like you may have some tinting applied to the FAB.

Make sure that the tint color from the FAB matches your expectation, as tinting will overrule bare color of drawables.

@mikepenz Thank your for that advise, I didn't know that such an modifier for drawables even existed.

I solved this as follows, if someone else has a similar problem.

button.imageTintList = null