Android如何根据背景图片更改文本颜色

问题描述:

在Android上,我有一个带有背景图片的标题(根据API的随机图片).在此标题上,我有一些数据文本.我的文字每次都是黑色的,但有时图像也是黑色的.因此,我们看不到文字.

On Android, I have a header with a background image (Random image according to API). On this header I have texts with some data. My text is every time black but sometimes image is black too. So, we can't see the text.

我正在寻找图书馆或摘要来解决此问题.谢谢.

I'm looking for library or snippet for resolve this problem. Thanks.

您可以为此使用palatte库.请参阅以下内容:

You can use the palatte library for this. Please see the following:

https://developer.android.com/reference/android/support/v7/graphics/Palette.html

https://developer.android.com/training/material/palette-colors.html