0
2

More than 3 years have passed since last update.

FloatingActionButtonが黒い場合の対処

Last updated at Posted at 2020-04-14

2020/5/12現在のお話
今後ハマるかもしれないので備忘録として

環境

implementation 'com.google.android.material:material:1.2.0-alpha03'

実装

<com.google.android.material.floatingactionbutton.FloatingActionButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="16dp"
            android:layout_marginBottom="16dp"
            android:backgroundTint="@color/hogehoge"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:srcCompat="@drawable/ic_add_white_16dp" />

ic_add_whiteはAndroid StudioのVectorAssetsから作ったいたって標準のもの

<vector android:height="16dp" android:tint="#FFFFFF"
    android:viewportHeight="24.0" android:viewportWidth="24.0"
    android:width="16dp" xmlns:android="http://schemas.android.com/apk/res/android">
    <path android:fillColor="#FF000000" android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
</vector>

こんな感じでなにごともなく実装していたが、なぜかic_add_white部分が黒く表示される
アイコン自体は白なのに・・・

なぜかと思ったらまさにこちらの話だった

app:tint="@androd:color/white"

を追加することで白くなりました

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2