Android 使用Pallate.Builder从位图中选择哪个颜色作为工具栏和状态?

Android 使用Pallate.Builder从位图中选择哪个颜色作为工具栏和状态?,android,android-layout,Android,Android Layout,我看到了新的材质设计whatsup,其中状态栏和工具栏颜色从配置文件图片更改。我想在我的项目中实现这一点,因此我生成pallate的代码如下 bitmap = BitmapFactory.decodeResource(getApplication().getResources(),R.drawable.special_offer_banner); Palette.Builder abcd = Palette.from(bitmap); abcd.generate

我看到了新的材质设计whatsup,其中状态栏和工具栏颜色从配置文件图片更改。我想在我的项目中实现这一点,因此我生成pallate的代码如下

        bitmap  = BitmapFactory.decodeResource(getApplication().getResources(),R.drawable.special_offer_banner);
    Palette.Builder abcd = Palette.from(bitmap);
    abcd.generate(new PaletteAsyncListener() {

        @Override
        public void onGenerated(Palette palette) {
            // TODO Auto-generated method stub

            // TODO Auto-generated method stub
            /***
             * from below swatches which swatch should i use for statusbar and toolbar
             */


            palette.getDarkMutedSwatch();//Or arg0.getDarkMutedColor(Color.WHITE); color for respective swatch
            palette.getDarkVibrantSwatch();
            palette.getLightMutedSwatch();
            palette.getLightVibrantSwatch();
            palette.getMutedSwatch();


            //---------------------OR--------------------------//
            List<Swatch> listOfSwatches = palette.getSwatches();//get All swatchs from palette

            for (Iterator iterator = listOfSwatches.iterator(); iterator
                    .hasNext();) {
                Swatch swatch = (Swatch) iterator.next();

                /***
                 * from below colors swatches which color should i use for statusbar and toolbar
                 */
                swatch.getBodyTextColor();
                swatch.getPopulation();
                swatch.getTitleTextColor();
                swatch.getRgb();
                swatch.getHsl();
            }

        }
    });
bitmap=BitmapFactory.decodeResource(getApplication().getResources(),R.drawable.special_offer_banner);
palete.Builder abcd=palete.from(位图);
生成(新的PaletteSyncListener()){
@凌驾
已生成的公共空心板(调色板){
//TODO自动生成的方法存根
//TODO自动生成的方法存根
/***
*从下面的样例中,我应该为状态栏和工具栏使用哪个样例
*/
palete.getDarkMutedSwatch();//或arg0.getDarkMutedColor(Color.WHITE);各自样例的颜色
palete.getDarkVibrantSwatch();
getLightMutedSwatch();
palete.getLightVibrantSwatch();
getMutedSwatch();
//---------------------或--------------------------//
List listOfSwatches=palette.getSwatches();//从palette获取所有样例
for(Iterator Iterator=listofswatchs.Iterator();Iterator
.hasNext();){
样例样例=(样例)迭代器.next();
/***
*从下面的颜色样例中,我应该为状态栏和工具栏使用哪种颜色
*/
swatch.getBodyTextColor();
swatch.getPopulation();
getTitleTextColor();
swatch.getRgb();
swatch.getHsl();
}
}
});
从上面的颜色/样例中,我应该为状态栏和工具栏使用哪种颜色/样例