android.widget.ImageView.setColorFilter()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(234)

本文整理了Java中android.widget.ImageView.setColorFilter()方法的一些代码示例,展示了ImageView.setColorFilter()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.setColorFilter()方法的具体详情如下:
包路径:android.widget.ImageView
类名称:ImageView
方法名:setColorFilter

ImageView.setColorFilter介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

ImageView lineColorCode = (ImageView)convertView.findViewById(R.id.line_color_code);
int color = Color.parseColor("#AE6118"); //The color u want             
lineColorCode.setColorFilter(color);

代码示例来源:origin: stackoverflow.com

ImageView Sun = (ImageView)findViewById(R.id.sun);
Sun.setColorFilter(ColorFilterGenerator.adjustHue(162)); // 162 degree rotation

代码示例来源:origin: stackoverflow.com

ImageView iv = (ImageView) findViewById(your_imageId);    
iv.setColorFilter(Color.argb(150, 155, 155, 155),   Mode.SRC_ATOP);

代码示例来源:origin: stackoverflow.com

ImageView button = (ImageView) findViewById(R.id.button);
button.setColorFilter(0xFFFF0000, PorterDuff.Mode.MULTIPLY);

代码示例来源:origin: yarolegovich/SlidingRootNav

@Override
public void bindViewHolder(ViewHolder holder) {
  holder.title.setText(title);
  holder.icon.setImageDrawable(icon);
  holder.title.setTextColor(isChecked ? selectedItemTextTint : normalItemTextTint);
  holder.icon.setColorFilter(isChecked ? selectedItemIconTint : normalItemIconTint);
}

代码示例来源:origin: mancj/MaterialSearchBar

private void setupNavIconTint() {
  if (navIconTintEnabled) {
    navIcon.setColorFilter(navIconTint, PorterDuff.Mode.SRC_IN);
  } else {
    navIcon.clearColorFilter();
  }
}

代码示例来源:origin: mancj/MaterialSearchBar

private void setupClearIconTint() {
  if (clearIconTintEnabled) {
    clearIcon.setColorFilter(clearIconTint, PorterDuff.Mode.SRC_IN);
  } else {
    clearIcon.clearColorFilter();
  }
}

代码示例来源:origin: mancj/MaterialSearchBar

private void setupMenuIconTint() {
  if (menuIconTintEnabled) {
    menuIcon.setColorFilter(menuIconTint, PorterDuff.Mode.SRC_IN);
  } else {
    menuIcon.clearColorFilter();
  }
}

代码示例来源:origin: Yalantis/uCrop

private void initiateRootViews(View view) {
  mUCropView = view.findViewById(R.id.ucrop);
  mGestureCropImageView = mUCropView.getCropImageView();
  mOverlayView = mUCropView.getOverlayView();
  mGestureCropImageView.setTransformImageListener(mImageListener);
  ((ImageView) view.findViewById(R.id.image_view_logo)).setColorFilter(mLogoColor, PorterDuff.Mode.SRC_ATOP);
  view.findViewById(R.id.ucrop_frame).setBackgroundColor(mRootViewBackgroundColor);
}

代码示例来源:origin: k9mail/k-9

private void setCryptoProviderIcon(Drawable openPgpApiProviderIcon, View view) {
  ImageView cryptoProviderIcon = view.findViewById(R.id.crypto_error_icon);
  if (openPgpApiProviderIcon != null) {
    cryptoProviderIcon.setImageDrawable(openPgpApiProviderIcon);
  } else {
    cryptoProviderIcon.setImageResource(R.drawable.status_lock_error);
    cryptoProviderIcon.setColorFilter(ThemeUtils.getStyledColor(getContext(), R.attr.openpgp_red));
  }
}

代码示例来源:origin: k9mail/k-9

private void setMessageSingleLine(@AttrRes int colorAttr, @StringRes int titleTextRes,
    @StringRes Integer descTextRes, @DrawableRes int statusIconRes) {
  @ColorInt int color = ThemeUtils.getStyledColor(getActivity(), colorAttr);
  statusIcon.setImageResource(statusIconRes);
  statusIcon.setColorFilter(color);
  titleText.setText(titleTextRes);
  if (descTextRes != null) {
    descriptionText.setText(descTextRes);
    descriptionText.setVisibility(View.VISIBLE);
  } else {
    descriptionText.setVisibility(View.GONE);
  }
}

代码示例来源:origin: north2016/T-MVP

@BindingAdapter({"imageUrl"})
public static void loadImg(ImageView v, String url) {
  v.setColorFilter(v.getContext().getResources().getColor(SpUtil.isNight() ? R.color.CoverColor : R.color.colorWhite), PorterDuff.Mode.MULTIPLY);
  Glide.with(v.getContext())
      .load(getFuckUrl(url))
      .diskCacheStrategy(DiskCacheStrategy.ALL)
      .into(v);
}

代码示例来源:origin: ogaclejapan/SmartTabLayout

public void setColorFilter(ColorStateList tint) {
 this.tint = tint;
 super.setColorFilter(tint.getColorForState(getDrawableState(), 0));
}

代码示例来源:origin: k9mail/k-9

private void setCryptoDisplayStatus(MessageCryptoDisplayStatus displayStatus) {
  int color = ThemeUtils.getStyledColor(getContext(), displayStatus.colorAttr);
  mCryptoStatusIcon.setEnabled(displayStatus.isEnabled);
  mCryptoStatusIcon.setVisibility(View.VISIBLE);
  mCryptoStatusIcon.setImageResource(displayStatus.statusIconRes);
  mCryptoStatusIcon.setColorFilter(color);
}

代码示例来源:origin: north2016/T-MVP

@BindingAdapter({"roundImageUrl"})
public static void loadRoundImg(ImageView v, String url) {
  v.setColorFilter(v.getContext().getResources().getColor(SpUtil.isNight() ? R.color.CoverColor : R.color.colorWhite), PorterDuff.Mode.MULTIPLY);
  Glide.with(v.getContext())
      .load(getFuckUrl(url))
      .diskCacheStrategy(DiskCacheStrategy.ALL)
      .transform(new GlideCircleTransform(v.getContext()))
      .error(R.mipmap.ic_launcher)
      .into(v);
}

代码示例来源:origin: north2016/T-MVP

@Override
public void onStart() {
  super.onStart();
  mBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
  imPay.setColorFilter(getContext().getResources().getColor(SpUtil.isNight() ? R.color.CoverColor : R.color.colorWhite), PorterDuff.Mode.MULTIPLY);
}

代码示例来源:origin: Yalantis/uCrop

private void initiateRootViews() {
  mUCropView = findViewById(R.id.ucrop);
  mGestureCropImageView = mUCropView.getCropImageView();
  mOverlayView = mUCropView.getOverlayView();
  mGestureCropImageView.setTransformImageListener(mImageListener);
  ((ImageView) findViewById(R.id.image_view_logo)).setColorFilter(mLogoColor, PorterDuff.Mode.SRC_ATOP);
  findViewById(R.id.ucrop_frame).setBackgroundColor(mRootViewBackgroundColor);
}

代码示例来源:origin: k9mail/k-9

public void selectUnifiedInbox() {
  unifiedInboxSelected = true;
  openedFolderServerId = null;
  accountHeader.setActiveProfile(DRAWER_ID_UNIFIED_INBOX);
  accountHeader.getHeaderBackgroundView().setColorFilter(0xFFFFFFFF, PorterDuff.Mode.MULTIPLY);
  clearUserFolders();
  updateFolderSettingsItem();
}

代码示例来源:origin: ZieIony/Carbon

@Override
  public void onAnimationUpdate(ValueAnimator valueAnimator) {
    ImageView imageView = (ImageView) animator.getTarget();
    float fraction = animator.getAnimatedFraction();
    saturationMatrix.setSaturation((Float) animator.getAnimatedValue());
    float scale = 2 - interpolator.getInterpolation(Math.min((1 - fraction) * 4 / 3, 1));
    brightnessMatrix.setScale(scale, scale, scale, 1);
    saturationMatrix.preConcat(brightnessMatrix);
    imageView.setColorFilter(new ColorMatrixColorFilter(saturationMatrix));
    imageView.setAlpha(interpolator.getInterpolation(Math.min((1 - fraction) * 2, 1)));
  }
});

代码示例来源:origin: ZieIony/Carbon

@Override
  public void onAnimationUpdate(ValueAnimator valueAnimator) {
    ImageView imageView = (ImageView) animator.getTarget();
    float fraction = animator.getAnimatedFraction();
    saturationMatrix.setSaturation((Float) animator.getAnimatedValue());
    float scale = 2 - interpolator.getInterpolation(Math.min(fraction * 4 / 3, 1));
    brightnessMatrix.setScale(scale, scale, scale, 1);
    saturationMatrix.preConcat(brightnessMatrix);
    imageView.setColorFilter(new ColorMatrixColorFilter(saturationMatrix));
    imageView.setAlpha(interpolator.getInterpolation(Math.min(fraction * 2, 1)));
  }
});

相关文章

ImageView类方法