兩個(gè)顏色取中間值
ArgbEvaluator.evaluate(float fraction,ObjectstartValue,ObjectendValue);
?????用于根據(jù)一個(gè)起始顏色值和一個(gè)結(jié)束顏色值以及一個(gè)偏移量生成一個(gè)新的顏色
https://developer.android.com/reference/android/animation/ArgbEvaluator.html
Bitmap中提取突出顏色
Palette
?????5.0加入的可以提取一個(gè)Bitmap中突出顏色的類
https://developer.android.com/reference/android/support/v7/graphics/Palette.html
//?Palette的部分?
Palette.generateAsync(bitmap,newPalette.PaletteAsyncListener()?{
/**
?????????*?提取完之后的回調(diào)方法
?????????*/
@Override
publicvoidonGenerated(Palette?palette)?{
????????????Palette.Swatch?vibrant?=?palette.getVibrantSwatch();??
/*?界面顏色UI統(tǒng)一性處理,看起來更Material一些?*/
????????????mPagerSlidingTabStrip.setBackgroundColor(vibrant.getRgb());??
????????????mPagerSlidingTabStrip.setTextColor(vibrant.getTitleTextColor());??
//?其中狀態(tài)欄、游標(biāo)侣夷、底部導(dǎo)航欄的顏色需要加深一下百拓,也可以不加,具體情況在代碼之后說明?
????????????mPagerSlidingTabStrip.setIndicatorColor(colorBurn(vibrant.getRgb()));??
????????????mToolbar.setBackgroundColor(vibrant.getRgb());??
if(android.os.Build.VERSION.SDK_INT?>=21)?{
????????????????Window?window?=?getWindow();??
//?很明顯决帖,這兩貨是新API才有的地回。?
????????????????window.setStatusBarColor(colorBurn(vibrant.getRgb()));??
????????????????window.setNavigationBarColor(colorBurn(vibrant.getRgb()));??
????????????}??
????????}??
????});??