本文整理汇总了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;
}
示例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;
}
}
示例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;
}
示例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));
}
}
}
示例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();
}
示例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);
}
}
示例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);
}
}
示例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());
}
}
}
}
示例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;
}
示例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);
}
}
示例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" );
}
}
示例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();
}
}
示例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);
}
示例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);
}
}
示例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;
}