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


Java ImageView.setTag方法代码示例

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


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

示例1: setContentImageDrawable

import android.widget.ImageView; //导入方法依赖的package包/类
public void setContentImageDrawable(Drawable imageDrawable) {
    if (imageDrawable != null) {
        LayoutInflater layoutInflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        ImageView imageView = (ImageView) layoutInflater.inflate(R.layout.cfdialog_imageview_header, cfDialogHeaderLinearLayout).findViewById(R.id.cfdialog_imageview_content);
        imageView.setImageDrawable(imageDrawable);
        imageView.setTag(111);
        cfDialogHeaderLinearLayout.setVisibility(View.VISIBLE);
    } else {
        for (int i = 0; i < cfDialogHeaderLinearLayout.getChildCount(); i++) {
            View view = cfDialogHeaderLinearLayout.getChildAt(i);
            if (view instanceof ImageView && (int) view.getTag() == 111) {
                cfDialogHeaderLinearLayout.removeView(view);
                cfDialogHeaderLinearLayout.setVisibility(View.GONE);
                break;
            }
        }
    }
}
 
开发者ID:Codigami,项目名称:CFAlertDialog,代码行数:19,代码来源:CFAlertDialog.java

示例2: onBindViewHolder

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    if (VIEW_TYPE_ITEM == getItemViewType(position)) {
        if ((position - 1) % 5 == 0) {
            ((ImageViewHolder) holder).tvTime.setVisibility(View.VISIBLE);
            ((ImageViewHolder) holder).tvTime.setText(timeFormat((position - 1) * 2));
        } else {
            ((ImageViewHolder) holder).tvTime.setVisibility(View.GONE);
        }
        String filePath = mPicturePathList.get(position - 1);
        ImageView imageView = ((ImageViewHolder) holder).ivImage;
        imageView.setTag(filePath);
        setImageView(filePath, imageView);
    } else {
        if (position == 0) {
            ((HeaderHolder) holder).ivSpot.setVisibility(View.GONE);
        } else {
            ((HeaderHolder) holder).ivSpot.setVisibility(View.VISIBLE);
            ((HeaderHolder) holder).tvTime.setVisibility(View.VISIBLE);
        }
    }
}
 
开发者ID:longkaiwen,项目名称:VideoSeekBar,代码行数:23,代码来源:VideoPreviewAdapter.java

示例3: onCreate

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

    AmbientMode.attachAmbientSupport(this);

    // Grab reference to each image in activity_photo_carousel.
    ImageView catImage = findViewById(R.id.cat_image);
    catImage.setTag(R.drawable.cats);
    catImage.setOnClickListener(this);

    ImageView dogImage = findViewById(R.id.dog_image);
    dogImage.setTag(R.drawable.dog);
    dogImage.setOnClickListener(this);

    ImageView hamsterImage = findViewById(R.id.hamster_image);
    hamsterImage.setTag(R.drawable.hamster);
    hamsterImage.setOnClickListener(this);

    ImageView birdImage = findViewById(R.id.bird_image);
    birdImage.setTag(R.drawable.birds);
    birdImage.setOnClickListener(this);
}
 
开发者ID:googlesamples,项目名称:android-WearAccessibilityApp,代码行数:25,代码来源:PhotoCarouselActivity.java

示例4: loadImage

import android.widget.ImageView; //导入方法依赖的package包/类
/**
 * Nonblocking call, return null if the bitmap is not in cache.
 * @param r
 * @return
 */
public Bitmap loadImage( LoadRequest r ) {
    if(r == null || r.getUri() == null || TextUtils.isEmpty(r.getUri().toString())) 
        throw new IllegalArgumentException( "null or empty request");

    ImageView iv = r.getImageView();
    if(iv != null){
        synchronized ( iv ) {
            iv.setTag(r.getUri()); // bind URI to the ImageView, to prevent image write-back of earlier requests.
        }
    }

    String key = r.getHashedUri();

    if(mCache != null && mCache.exists(key)) {
        return mCache.loadData(key);
    }
    else { 
        // not ready yet, try to retrieve it asynchronously.
        mExecutor.execute( newRequestCall(r));
        return null;
    }
}
 
开发者ID:archos-sa,项目名称:aos-MediaLib,代码行数:28,代码来源:HttpImageManager.java

示例5: ViewHolder

import android.widget.ImageView; //导入方法依赖的package包/类
ViewHolder(View view) {
    super(view);
    mViewTab = (TextView) view.findViewById(R.id.tv_content);
    mViewBubble = (TextView) view.findViewById(R.id.tv_bubble);
    mViewDel = (ImageView) view.findViewById(R.id.iv_delete);

    mViewTab.setTextColor(new ColorStateList(new int[][]{
                    new int[]{-android.R.attr.state_activated},
                    new int[]{}
            }, new int[]{0XFF24CF5F, 0XFF6A6A6A})
    );
    mViewTab.setActivated(true);

    mViewTab.setTag(this);
    mViewDel.setTag(this);
    mViewDel.setOnClickListener(getDeleteItemListener());
    mViewTab.setOnClickListener(getClickTabItemListener());
    mViewTab.setOnTouchListener(getTouchTabItemListener());
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:20,代码来源:TabPickerView.java

示例6: notifyDataSetChanged

import android.widget.ImageView; //导入方法依赖的package包/类
public void notifyDataSetChanged() {
  mIconsLayout.removeAllViews();
  IconPagerAdapter iconAdapter = (IconPagerAdapter) mViewPager.getAdapter();
  int count = iconAdapter.getCount();
  for (int i = 0; i < count; i++) {
    ImageView view = new ImageView(getContext(), null, R.attr.actionButtonStyle);
    view.setImageResource(iconAdapter.getIconResId(i));
    view.setTag(i);
    view.setOnClickListener(this);
    mIconsLayout.addView(view, new LayoutParams(WRAP_CONTENT, MATCH_PARENT));
  }
  if (mSelectedIndex > count) {
    mSelectedIndex = count - 1;
  }
  setCurrentItem(mSelectedIndex);
  requestLayout();
}
 
开发者ID:Elias33,项目名称:Quran,代码行数:18,代码来源:IconPageIndicator.java

示例7: getView

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View view = getLayoutInflater().inflate(R.layout.item_image, null);
    ImageView iv = (ImageView) view.findViewById(R.id.iv);
    Glide.with(GridView2Activity.this)
            .load(mThumbViewInfoList.get(position).getUrl())
            .error(R.mipmap.ic_iamge_zhanwei)
            .into(iv);
    iv.setTag(R.id.iv, mThumbViewInfoList.get(position));
    return view;
}
 
开发者ID:yangchaojiang,项目名称:ZoomPreviewPicture,代码行数:12,代码来源:GridView2Activity.java

示例8: showThumb

import android.widget.ImageView; //导入方法依赖的package包/类
public void showThumb(String path, ImageView imgview, int width, int height) {

        if (getVideoThumbToCache(path) == null) {
            // 异步加载
            imgview.setTag(path);
            new MyBobAsynctack(imgview, path, width, height).execute(path);
        } else {
            imgview.setImageBitmap(getVideoThumbToCache(path));
        }

    }
 
开发者ID:lo625090140,项目名称:lqrwechatrongcloud,代码行数:12,代码来源:VideoThumbLoader.java

示例9: createThumbnailView

import android.widget.ImageView; //导入方法依赖的package包/类
private ImageView createThumbnailView(LinearLayout.LayoutParams lp, Bitmap thumbnail) {
    ImageView thumbnailView = new ImageView(context);
    thumbnailView.setLayoutParams(lp);
    thumbnailView.setImageBitmap(thumbnail);
    thumbnailView.setTag(mListOfMedia.size() - 1);
    thumbnailView.setOnClickListener(thumbnailOnClickListener);
    thumbnailView.setScaleType(ImageView.ScaleType.CENTER);
    return thumbnailView;
}
 
开发者ID:yangchong211,项目名称:YCGallery,代码行数:10,代码来源:GalleryImageView.java

示例10: onActivityResult

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
	// TODO Auto-generated method stub
	super.onActivityResult(requestCode, resultCode, data);
	paoPaoQuan.setSelection(paoPaoState);
	// requestCode标示请求的标示 resultCode表示有数据
	Log.d("js", requestCode + "//" + resultCode + "**" + data);
	if (requestCode==4||data != null) {
		int childCount = imageGrid.getChildCount();
		if (childCount > 9) {
			Toast.makeText(this, "最多选择9张图片", 1).show();
		} else {
			imageId++;
			String fPath = null;
			if (requestCode == 4) {
				fPath = mCurrentPhotoPath;
			}else{
				Uri uri = data.getData(); // 得到Uri
				if((uri!=null&&!uri.equals(""))){
					fPath = StaticMethod.getImageAbsolutePath(this, uri); // 转化为路径
				}
			}
			Bitmap b = BitmapFactory.decodeFile(fPath);
			b = StaticMethod.getThumImg(b, 100);
			ImageView image = new ImageView(this);
			image.setLayoutParams(new LayoutParams(130, 130));
			image.setScaleType(ScaleType.FIT_XY);
			image.setId(imageId);
			image.setTag(fPath);
			image.setImageBitmap(b);
			image.setOnClickListener(this);
			imageGrid.addView(image, childCount - 1);
			}
	}

}
 
开发者ID:smartbeng,项目名称:PaoMovie,代码行数:37,代码来源:SendPaoPaoPic.java

示例11: init

import android.widget.ImageView; //导入方法依赖的package包/类
/**
 * 初始化
 */
private void init() {
    LinearLayout layout = new LinearLayout(getContext());
    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, WheelUtils.dip2px(getContext(),
            WheelConstants
                    .WHEEL_ITEM_HEIGHT));
    layout.setOrientation(LinearLayout.HORIZONTAL);
    layout.setPadding(WheelConstants.WHEEL_ITEM_PADDING, WheelConstants.WHEEL_ITEM_PADDING, WheelConstants
            .WHEEL_ITEM_PADDING, WheelConstants.WHEEL_ITEM_PADDING);
    layout.setGravity(Gravity.CENTER);
    addView(layout, layoutParams);

    // 图片
    mImage = new ImageView(getContext());
    mImage.setTag(WheelConstants.WHEEL_ITEM_IMAGE_TAG);
    mImage.setVisibility(View.GONE);
    LayoutParams imageParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    imageParams.rightMargin = WheelConstants.WHEEL_ITEM_MARGIN;
    layout.addView(mImage, imageParams);

    // 文本
    mText = new TextView(getContext());
    mText.setTag(WheelConstants.WHEEL_ITEM_TEXT_TAG);
    mText.setEllipsize(TextUtils.TruncateAt.END);
    mText.setSingleLine();
    mText.setIncludeFontPadding(false);
    mText.setGravity(Gravity.CENTER);
    mText.setTextColor(Color.BLACK);
    LayoutParams textParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    layout.addView(mText, textParams);
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:34,代码来源:WheelItem.java

示例12: loadImage

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void loadImage(ImageView imageView, String imagePath, int viewWidth, int viewHeight) {
    imageView.setTag(R.id.album_image_load_tag, imagePath);
    Bitmap bitmap = getImageFromCache(imagePath, viewWidth, viewHeight);
    if (bitmap == null) {
        imageView.setImageDrawable(sPlaceHolderDrawable);
        mExecutorService.execute(new LoadImageTask(this, imageView, imagePath, viewWidth, viewHeight));
    } else {
        BitmapHolder holder = new BitmapHolder();
        holder.mImageView = imageView;
        holder.mTargetPath = imagePath;
        holder.mBitmap = bitmap;
        getHandler().post(holder);
    }
}
 
开发者ID:WeiXinqiao,项目名称:Recognize-it,代码行数:16,代码来源:DefaultAlbumLoader.java

示例13: getView

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View view = getLayoutInflater().inflate(R.layout.item_image, null);
    ImageView iv = (ImageView) view.findViewById(R.id.iv);
    Glide.with(GridViewCustomActivity.this)
            .load(mThumbViewInfoList.get(position).getUrl())
            .error(R.mipmap.ic_iamge_zhanwei)
            .into(iv);
    iv.setTag(R.id.iv, mThumbViewInfoList.get(position));
    return view;
}
 
开发者ID:yangchaojiang,项目名称:ZoomPreviewPicture,代码行数:12,代码来源:GridViewCustomActivity.java

示例14: setColorPreview

import android.widget.ImageView; //导入方法依赖的package包/类
public void setColorPreview(LinearLayout colorPreview, Integer selectedColor) {
	if (colorPreview == null)
		return;
	this.colorPreview = colorPreview;
	if (selectedColor == null)
		selectedColor = 0;
	int children = colorPreview.getChildCount();
	if (children == 0 || colorPreview.getVisibility() != View.VISIBLE)
		return;

	for (int i = 0; i < children; i++) {
		View childView = colorPreview.getChildAt(i);
		if (!(childView instanceof LinearLayout))
			continue;
		LinearLayout childLayout = (LinearLayout) childView;
		if (i == selectedColor) {
			childLayout.setBackgroundColor(Color.WHITE);
		}
		ImageView childImage = (ImageView) childLayout.findViewById(R.id.image_preview);
		childImage.setClickable(true);
		childImage.setTag(i);
		childImage.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				if (v == null)
					return;
				Object tag = v.getTag();
				if (tag == null || !(tag instanceof Integer))
					return;
				setSelectedColor((int) tag);
			}
		});
	}
}
 
开发者ID:l465659833,项目名称:Bigbang,代码行数:35,代码来源:ColorPickerView.java

示例15: rightButton

import android.widget.ImageView; //导入方法依赖的package包/类
public TitleBar rightButton(final int index, int iconId){
	ImageView iv = generateRightButton(iconId);
	iv.setTag(index);
	this.title_bar_ll_right.addView(iv);
	iv.setOnClickListener(new OnClickListener() {
		
		@Override
		public void onClick(View v) {
			callback.onRightButtonClicked(index, v);
		}
	});
	return this;
}
 
开发者ID:cowthan,项目名称:ayo-menu,代码行数:14,代码来源:TitleBar.java


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