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

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

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

ImageView.setImageIcon介绍

暂无

代码示例

代码示例来源:origin: google/santa-tracker-android

/**
 * Helps toggle the complication and complication background view when the complication is set
 * or not set.
 *
 * <p>If no complication data provider is set, the background will be dotted line circle and
 * complication is set to a cross.
 *
 * <p>If complication data provider is set, the background will be a solid line circle and
 * complication will be set to the icon of the provider.
 */
private void toggleAddComplications(
    ImageView complication,
    ImageView complicationBackground,
    ComplicationProviderInfo complicationProviderInfo) {
  if (complicationProviderInfo != null) {
    complication.setImageIcon(complicationProviderInfo.providerIcon);
    complicationBackground.setImageDrawable(mSolidBackground);
  } else {
    complication.setImageDrawable(mDefaultAddComplicationDrawable);
    complicationBackground.setImageDrawable(mDottedBackground);
  }
}

代码示例来源:origin: qyxxjd/CommonAdapter

@RequiresApi(api = Build.VERSION_CODES.M)
public BaseAdapterHelper setImageIcon(@IdRes int viewId, @NonNull Icon icon) {
  ((ImageView)retrieveView(viewId)).setImageIcon(icon);
  return this;
}

代码示例来源:origin: Abhinav1997/NekoCollector

Context context = holder.itemView.getContext();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
  holder.imageView.setImageIcon(mCats.get(position).createLargeIcon(context));
} else {
  holder.imageView.setImageBitmap(mCats.get(position).createLargeBitmap(context));

代码示例来源:origin: googlesamples/android-WatchFace

.getBackground()
    .setColorFilter(backgroundColorFilter);
mWatchFaceBackgroundPreviewImageView.setImageIcon(
    complicationProviderInfo.providerIcon);

代码示例来源:origin: Abhinav1997/NekoCollector

@Override
  public void onClick(View view) {
    cat[0] = Cat.create(getApplicationContext());
    catIcon[0] = new BitmapDrawable(getResources(), cat[0].createLargeBitmap(getApplicationContext()));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
      imageView.setImageIcon(cat[0].createLargeIcon(getApplicationContext()));
    } else {
      imageView.setImageDrawable(catIcon[0]);
    }
  }
});

代码示例来源:origin: Abhinav1997/NekoCollector

final Drawable[] catIcon = {new BitmapDrawable(getResources(), cat[0].createLargeBitmap(this))};
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
  imageView.setImageIcon(cat[0].createLargeIcon(this));
} else {
  imageView.setImageDrawable(catIcon[0]);

相关文章

ImageView类方法