问题描述
<layout>
<CoordinatorLayout>
<AppBarLayout>
... some tags and stuff ...
</AppBarLayout>
<nestedScrollView>
.... nested scroll view stuff
</nestedScrollView>
<!-- Finally! Here comes.... -->
<FloatingActionButton>
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="8dp"
android:backgroundTint="@color/someDarkBlueColor"
android:tint="@color/colorWhite"
android:src="@drawable/ic_white_camera" />
... closing tags and stuff ....
ic_white_camera如下:
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="200dp" android:height="200dp" android:viewportWidth="24.0" android:viewportHeight="24.0">
<path android:fillColor="@color/colorWhite" android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,-6.4 0"/>
<path android:fillColor="@color/colorWhite" android:pathData="M9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2L9,2zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,2.24 5,5 -2.24,5 -5,5z"/>
</vector>
@ color / colorWhite 是..您猜到了。白色...
但是android坚持以黑色渲染摄像头图标!
我尝试添加android:tint="@color/colorWhite"
。不行。
添加了android:foregroundTint="@color/colorWhite"
和... Nada!
仍然得到这个:
关于这个的任何线索吗?
最诚挚的问候..:-)
解决方法
如果使用FloatingActionButton
软件包中的com.google.android.material
,则应添加app:tint
而不是android:tint
。然后,在您的xml中,您应该使用app:tint="@color/colorWhite"
而不是android:tint="@color/colorWhite"
。
右边的attributes是:
Caused by: org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.io.NotSerializableException: org.springframework.dao.support.PersistenceExceptionTranslationInterceptor
at org.springframework.core.serializer.support.SerializingConverter.convert(SerializingConverter.java:68)
at org.springframework.core.serializer.support.SerializingConverter.convert(SerializingConverter.java:35)
at org.springframework.core.convert.support.GenericConversionService$ConverterAdapter.convert(GenericConversionService.java:385)
at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:41)
... 139 more
<com.google.android.material.floatingactionbutton.FloatingActionButton
app:srcCompat="@drawable/ic_white_camera"
app:tint="@color/colorWhite"
app:backgroundTint="@color/someDarkBlueColor"/>
与VectorDrawable
一起使用很重要。
我不确定您到底想要什么效果,但是您可以尝试注释或删除此行:
android:backgroundTint="@color/someDarkBlueColor"
或调整someDarkBlueColor
的值。