當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。