當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageView.getTag方法代碼示例

本文整理匯總了Java中android.widget.ImageView.getTag方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageView.getTag方法的具體用法?Java ImageView.getTag怎麽用?Java ImageView.getTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.ImageView的用法示例。


在下文中一共展示了ImageView.getTag方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getView

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder viewHolder;
    if (convertView == null) {
        convertView = mLayoutInflater.inflate(R.layout.item_grid, parent, false);
        viewHolder = new ViewHolder();
        viewHolder.mImageView = (ImageView) convertView.findViewById(R.id.image_view);
        convertView.setTag(viewHolder);
    } else {
        viewHolder = (ViewHolder) convertView.getTag();
    }

    ImageView imageView = viewHolder.mImageView;
    String tag = (String) imageView.getTag();
    String uri = getItem(position);

    if (!uri.equals(tag)) {
        imageView.setImageDrawable(new ColorDrawable(getResources().getColor(R.color.colorAccent)));
    }

    if (mIsGridViewIdle && mCanGetBitmapFromNetWork) {
        imageView.setTag(uri);
        mImageLoadUtil.bindBitmap(mUrls.get(position), imageView, mImageWidth, mImageWidth);
    }
    return convertView;
}
 
開發者ID:DysaniazzZ,項目名稱:ArtOfAndroid,代碼行數:27,代碼來源:MainActivity.java

示例2: handleMessage

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
public void handleMessage(Message msg) {
    switch (msg.what) {
        case MSG_LOAD_RESULT:
            LoaderResult loaderResult = (LoaderResult) msg.obj;
            ImageView imageView = loaderResult.mImageView;
            String url = (String) imageView.getTag(TAG_KEY_URL);
            if (!TextUtils.isEmpty(url) && url.equals(loaderResult.mUrl)) {
                imageView.setImageBitmap(loaderResult.mBitmap);
            } else {
                Log.w(TAG, "set image bitmap, but url has changed.");
            }
            break;
        default:
            super.handleMessage(msg);
            break;
    }
}
 
開發者ID:DysaniazzZ,項目名稱:ArtOfAndroid,代碼行數:19,代碼來源:ImageLoadUtil.java

示例3: loadPic

import android.widget.ImageView; //導入方法依賴的package包/類
public static Request loadPic(ImageView imageview, ImageGotListener listener, String url, Bitmap defaultbitmap, boolean forceupdate) {
	Request request = null;
	if (imageview != null) {
		Object object = imageview.getTag();
		if (object != null && object instanceof Request) {
			//reuse the request.
			request = (Request) object;
			//ignore this request.
			request.endRequest();
		}
	}
	request = getInstance().buildRequest(imageview, listener, url, defaultbitmap, forceupdate);
	if (imageview != null) {
		imageview.setTag(request);
	}
	request.getPic();
	return request;
}
 
開發者ID:MobClub,項目名稱:BBSSDK-for-Android,代碼行數:19,代碼來源:ImageGetter.java

示例4: setBitmapForView

import android.widget.ImageView; //導入方法依賴的package包/類
static void setBitmapForView(View view, Bitmap bitmap, String url, boolean doAnim) {
    if (view != null && bitmap != null && !TextUtils.isEmpty(url) && !bitmap.isRecycled() && view.getTag(R.id.view_tag) != null && view.getTag(R.id.view_tag).toString().equals(url)) {
        view.setTag(R.id.view_result, Boolean.valueOf(true));
        if (view instanceof ImageView) {
            ImageView imageView = (ImageView) view;
            if (imageView.getTag(R.id.imageview_atts) == null || !imageView.getTag(R.id.imageview_atts).toString().contains("background")) {
                if (imageView.getTag(R.id.scale_type) instanceof ScaleType) {
                    imageView.setScaleType((ScaleType) imageView.getTag(R.id.scale_type));
                } else {
                    imageView.setScaleType(ScaleType.FIT_XY);
                }
                imageView.setImageBitmap(bitmap);
            } else {
                view.setBackgroundDrawable(new BitmapDrawable(bitmap));
            }
        } else {
            view.setBackgroundDrawable(new BitmapDrawable(bitmap));
        }
        if (doAnim) {
            view.startAnimation(AnimationUtils.loadAnimation(BaseApplication.getInstance(), R.anim.fade_in));
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:24,代碼來源:ImageDownloader.java

示例5: setImage

import android.widget.ImageView; //導入方法依賴的package包/類
public void setImage() {
    if (bm != null) {
        if(wr_image == null)
            return;
        ImageView iv = wr_image.get();
        if(iv != null)
        {
            String tag = (String) iv.getTag();
            if(TextUtils.isEmpty(tag)) {
                iv.setImageBitmap(bm);
            } else if(this.url.equals(tag)) {
                iv.setImageBitmap(bm);
            }
        }
    }
    this.onLoadFinish();
}
 
開發者ID:junchenChow,項目名稱:exciting-app,代碼行數:18,代碼來源:StickerManager2.java

示例6: setCurrItem

import android.widget.ImageView; //導入方法依賴的package包/類
public void setCurrItem(int position) {
    if (mImageViews != null) {
        for (int i = 0; i < mImageViews.length; i++) {
            if (style == STYLE_DOT) {
                mImageViews[i].setImageDrawable(getGradientDrawable(position == i ? focusColor : norColor, radius));
            } else if (style == STYLE_IMG){
                ImageView imageView = mImageViews[i];
                if (imageView.getTag(R.id.TANGRAM_BANNER_INDICATOR_POS) == null) {
                    continue;
                } else {
                    imageView.setTag(R.id.TANGRAM_BANNER_INDICATOR_POS, null);
                    ImageUtils.doLoadImageUrl(imageView, norUrl);
                }
            }
        }
        mImageViews[currentItemPos].setTag(R.id.TANGRAM_BANNER_INDICATOR_POS, currentItemPos);
        ImageUtils.doLoadImageUrl(mImageViews[currentItemPos], focusUrl);
    }
}
 
開發者ID:alibaba,項目名稱:Tangram-Android,代碼行數:20,代碼來源:BannerView.java

示例7: setDaySelected

import android.widget.ImageView; //導入方法依賴的package包/類
private void setDaySelected(ImageView dayView, boolean b) {
    dayView.setSelected(b);
    String dayText = getDayText(dayView);
    int tag = (int) dayView.getTag();
    if (b) {
        dayView.setImageDrawable(selectedBuilder.build(dayText, selectedDayBackgroundColor));
        selectedDays.add(tag);
    } else {
        dayView.setImageDrawable(unselectedBuilder.build(dayText, unSelectedDayBackgroundColor));
        selectedDays.remove(tag);
    }
}
 
開發者ID:DavidProdinger,項目名稱:Weekdays-Selector,代碼行數:13,代碼來源:WeekdaysPicker.java

示例8: processImageResult

import android.widget.ImageView; //導入方法依賴的package包/類
private void processImageResult(ImageResult imageResult) {
        if (imageResult != null) {
            ImageRequest request = imageResult.getRequest();
            ImageView imageView = request.target.get();
            if (imageView != null) {
                Object tag = imageView.getTag();
                if (tag != null && tag.equals(request.url)) {
                    TransitionDrawable drawable = new TransitionDrawable(new Drawable[]{EMPTY_DRAWABLE, new BitmapDrawable(imageResult.getBitmap())});
                    imageView.setImageDrawable(drawable);
                    drawable.startTransition(1000);
//                    imageView.setImageBitmap(imageResult.getBitmap());
                }
            }
        }
    }
 
開發者ID:IstiN,項目名稱:android-training-2017,代碼行數:16,代碼來源:Malevich.java

示例9: isAlreadyProcessed

import android.widget.ImageView; //導入方法依賴的package包/類
private static boolean isAlreadyProcessed(ImageView imageView, Uri uri) {
    if(imageView != null) {
        PhotoViewTag vt = (PhotoViewTag) imageView.getTag(TAG_PHOTO_INFOS);
        return (vt != null && UriUtils.areEqual(uri, vt.uri));
    }
    return true;
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:8,代碼來源:ContactsAsyncHelper.java

示例10: stopLoading

import android.widget.ImageView; //導入方法依賴的package包/類
/**
 * Cancels any ongoing load operations associated with the given ImageView.
 * @param icon
 */
public void stopLoading(ImageView icon) {
    if(null == icon){
        return;
    }
    final LoaderTask oldTask = (LoaderTask) icon.getTag();
    if (oldTask != null) {
        oldTask.preempt();
        icon.setTag(null);
    }
}
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:15,代碼來源:IconHelper.java

示例11: handleMessage

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
public void handleMessage(Message msg) {
    LoaderResult result = (LoaderResult) msg.obj;
    ImageView imageView = result.imageView;
    String uri = (String) imageView.getTag(TAG_KEY_URI);
    //判斷是防止錯位
    if(uri.equals(result.uri)){
        imageView.setImageBitmap(result.bitmap);
    }else{
        Log.w(TAG, "set image bitmap,but url has changed,igored" );
    }
}
 
開發者ID:Jiabaokang,項目名稱:JBKWeather,代碼行數:13,代碼來源:ImageLoader.java

示例12: getToogleImageStatus

import android.widget.ImageView; //導入方法依賴的package包/類
public static boolean getToogleImageStatus(ImageView iv1){
	if (iv1 == null || iv1.getTag() == null){
		return false;
	}else{
		return (Boolean)iv1.getTag();
	}
}
 
開發者ID:SShineTeam,項目名稱:Huochexing12306,代碼行數:8,代碼來源:MyUtils.java

示例13: setImageType

import android.widget.ImageView; //導入方法依賴的package包/類
public static void setImageType(@NonNull ImageView imageView, @NonNull Enum<?> type, @ColorInt int tintColor) {
    initialize();

    if (imageView.getTag(R.id.eavd_current_type) == null || !(imageView.getTag(R.id.eavd_current_type) instanceof Enum<?>)) {
        setImageDrawable(imageView, getDefaultDrawableResId(type), type, tintColor);
        return;
    }

    final Enum<?> currentType = (Enum<?>) imageView.getTag(R.id.eavd_current_type);
    final Object currentTintColorObject = imageView.getTag(R.id.eavd_current_tint_color);
    final int currentTintColor = currentTintColorObject == null ? 0 : (int) currentTintColorObject;
    if (currentType == type && currentTintColor == tintColor) {
        // Both types are equals, do nothing.
        return;
    }

    try {
        int animatedVectorDrawable = getAnimatedVectorDrawable(currentType, type);
        if (animatedVectorDrawable != 0) {
            setImageDrawable(imageView, animatedVectorDrawable, type, tintColor);
            return;
        }
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    }

    setImageDrawable(imageView, getDefaultDrawableResId(type), type, tintColor);
}
 
開發者ID:DenisMondon,項目名稱:easy-animated-vector-drawable,代碼行數:29,代碼來源:EasyAnimatedVectorDrawable.java

示例14: handleMessage

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
public void handleMessage(Message msg) {
    super.handleMessage(msg);
    LoaderResult result = (LoaderResult) msg.obj;
    ImageView imageView = result.imageView;
    imageView.setImageBitmap(result.bitmap);
    String uri = (String) imageView.getTag(TAG_KEY_URL);
    if (uri.equals(result.uri)) {
        imageView.setImageBitmap(result.bitmap);
    }
}
 
開發者ID:wuhighway,項目名稱:DailyStudy,代碼行數:12,代碼來源:ImageLoader.java

示例15: toggleLED

import android.widget.ImageView; //導入方法依賴的package包/類
/**
 * Sets a clicked cell on/off.
 *
 * @param image An image of a clicked cell.
 * @param pos   Position of a clicked cell.
 * @return True, if cell is on and false otherwise.
 */
private boolean toggleLED(ImageView image, int pos) {
    boolean isOn;
    //Toast.makeText(this, "Pos :" +  pos, Toast.LENGTH_SHORT).show();
    int state = (Integer) image.getTag(R.id.ledState);
    if(state != 1) {
        DEVICE_CODE_ARRAY[pos] = 1;
        image.setBackground(getApplication().getResources().getDrawable(R.drawable.red_white_led_btn));
        image.setTag(R.id.ledState, 1);
        isOn = true;

    } else {
        DEVICE_CODE_ARRAY[pos] = 0;
        image.setBackground(getApplication().getResources().getDrawable(R.drawable.white_red_led_btn));
        image.setTag(R.id.ledState, 0);
        isOn = false;
        // Update the code to consider the still ON LED below the toggled one
        if(pos < 20) {
            DEVICE_CODE_ARRAY[pos + 5] = 1;
        }
    }

    image.setSelected(false);
    int position = (Integer) image.getTag(R.id.position);
    image.setContentDescription("" + position + getLEDStatus(pos));
    return isOn;
}
 
開發者ID:Samsung,項目名稱:microbit,代碼行數:34,代碼來源:PairingActivity.java


注:本文中的android.widget.ImageView.getTag方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。