当前位置: 首页>>代码示例>>Java>>正文


Java BitmapDrawable.setColorFilter方法代码示例

本文整理汇总了Java中android.graphics.drawable.BitmapDrawable.setColorFilter方法的典型用法代码示例。如果您正苦于以下问题:Java BitmapDrawable.setColorFilter方法的具体用法?Java BitmapDrawable.setColorFilter怎么用?Java BitmapDrawable.setColorFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.drawable.BitmapDrawable的用法示例。


在下文中一共展示了BitmapDrawable.setColorFilter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setBackground

import android.graphics.drawable.BitmapDrawable; //导入方法依赖的package包/类
public void setBackground(Activity activity) {
    if (mImageCache.size() != 0) {
        BitmapDrawable bd = new BitmapDrawable(activity.getResources(), mImageCache.get(CACHE_BLURRED_IMAGE));
        bd.setAlpha(mAlpha);
        if (mFilterColor != -1) {
            bd.setColorFilter(mFilterColor, PorterDuff.Mode.DST_ATOP);
        }
        activity.getWindow().setBackgroundDrawable(bd);
        mImageCache.remove(CACHE_BLURRED_IMAGE);
        CacheBlurExecuteTask = null;
    }
}
 
开发者ID:yangchong211,项目名称:YCUtils,代码行数:13,代码来源:BlurBehind.java

示例2: onCreate

import android.graphics.drawable.BitmapDrawable; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_animations);

    // Grayscale filter used on all thumbnails
    ColorMatrix grayMatrix = new ColorMatrix();
    grayMatrix.setSaturation(0);
    ColorMatrixColorFilter grayscaleFilter = new ColorMatrixColorFilter(grayMatrix);
    
    mGridLayout = (GridLayout) findViewById(R.id.gridLayout);
    mGridLayout.setColumnCount(3);
    mGridLayout.setUseDefaultMargins(true);
    
    // add all photo thumbnails to layout
    Resources resources = getResources();
    ArrayList<PictureData> pictures = mBitmapUtils.loadPhotos(resources);
    for (int i = 0; i < pictures.size(); ++i) {
        PictureData pictureData = pictures.get(i);
        BitmapDrawable thumbnailDrawable =
                new BitmapDrawable(resources, pictureData.thumbnail);
        thumbnailDrawable.setColorFilter(grayscaleFilter);
        ImageView imageView = new ImageView(this);
        imageView.setOnClickListener(thumbnailClickListener);
        imageView.setImageDrawable(thumbnailDrawable);
        mPicturesData.put(imageView, pictureData);
        mGridLayout.addView(imageView);
    }
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:30,代码来源:ActivityAnimations.java

示例3: setBackground

import android.graphics.drawable.BitmapDrawable; //导入方法依赖的package包/类
public void setBackground(Activity activity) {
    if (mImageCache.size() != 0) {
        BitmapDrawable bd = new BitmapDrawable(activity.getResources(), mImageCache.get(KEY_CACHE_BLURRED_BACKGROUND_IMAGE));
        bd.setAlpha(mAlpha);
        if (mFilterColor != -1) {
            bd.setColorFilter(mFilterColor, PorterDuff.Mode.DST_ATOP);
        }
        activity.getWindow().setBackgroundDrawable(bd);
        mImageCache.remove(KEY_CACHE_BLURRED_BACKGROUND_IMAGE);
        cacheBlurBehindAndExecuteTask = null;
    }
}
 
开发者ID:Luodian,项目名称:Shared-Route,代码行数:13,代码来源:BlurBehind.java


注:本文中的android.graphics.drawable.BitmapDrawable.setColorFilter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。