Best code examples for ImageView setImageDrawable method (android.widget.ImageView.setImageDrawable)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ImageView setImageDrawable method.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

ImageView setImageDrawable examples from Open Source projects
This code example shows how to use the following methods: getVisibility, setImageDrawable, setVisibility
218:	mIconView.setImageDrawable(showIcon ? icon : null); 
-
220:	if (mIconView.getVisibility() != VISIBLE) { 
221:	mIconView.setVisibility(VISIBLE); 
-
224:	mIconView.setVisibility(GONE); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: setImageDrawable, setImageResource, setVisibility
168:	mAirplane.setImageDrawable(null); 
-
205:	mAirplane.setImageResource(mAirplaneIconId); 
206:	mAirplane.setVisibility(View.VISIBLE); 
-
208:	mAirplane.setVisibility(View.GONE); 
Full Snippet Info
10
CodeRank
This code example shows how to use the following methods: getTag, setTag, getDrawable, setImageDrawable
181:	if (thumbImageView.getTag() != null 
182:	&& thumbImageView.getTag().equals(tempThumbnailImageFileName)) { 
-
187:	final BitmapWorkerTask task = new BitmapWorkerTask(thumbImageView, 
-
192:	thumbImageView.setImageDrawable(asyncDrawable); 
193:	thumbImageView.setTag(tempThumbnailImageFileName); 
-
231:	final Drawable drawable = imageView.getDrawable(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setId, setTag, setImageDrawable, setScaleType, setVisibility
347:	mStatusButton = new ImageView(mContext); 
348:	mStatusButton.setId(id); 
349:	mStatusButton.setScaleType(ScaleType.CENTER); 
-
352:	mStatusButton.setImageDrawable(icon); 
353:	mStatusButton.setTag(appId); 
354:	mStatusButton.setVisibility(View.VISIBLE); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: clearAnimation, getAnimation, getContext, getTag, setTag
94:	if (!equals(view.getTag())) 
-
97:	view.setTag(null); 
-
99:	if (fadeIn && view.getAnimation() == null) 
100:	view.startAnimation(AnimationUtils.loadAnimation(view.getContext(), 
-
102:	view.setImageBitmap(result); 
-
104:	view.setImageDrawable(null); 
105:	view.clearAnimation(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getVisibility, setImageDrawable, setVisibility
212:	mIconView.setImageDrawable(showIcon ? icon : null); 
-
214:	if (mIconView.getVisibility() != VISIBLE) { 
215:	mIconView.setVisibility(VISIBLE); 
-
218:	mIconView.setVisibility(GONE); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setLayoutParams, setImageDrawable, setScaleType
56:	ImageView i = new ImageView(LayoutAnimation1.this); 
-
60:	i.setImageDrawable(info.activityInfo.loadIcon(getPackageManager())); 
61:	i.setScaleType(ImageView.ScaleType.FIT_CENTER); 
-
63:	i.setLayoutParams(new GridView.LayoutParams(w, w)); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getTag, setTag, setImageDrawable
199:	imageView.setImageDrawable(dummyDrawable); 
-
202:	String oldImageUrl = (String) imageView.getTag(); 
-
208:	imageView.setImageDrawable(dummyDrawable); 
209:	imageView.setTag(imageUrl); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setLayoutParams, setImageDrawable, setScaleType
68:	i = new ImageView(Grid1.this); 
69:	i.setScaleType(ImageView.ScaleType.FIT_CENTER); 
70:	i.setLayoutParams(new GridView.LayoutParams(50, 50)); 
-
76:	i.setImageDrawable(info.activityInfo.loadIcon(getPackageManager())); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setLayoutParams, setImageDrawable, setScaleType
76:	i = new ImageView(Grid3.this); 
77:	i.setScaleType(ImageView.ScaleType.FIT_CENTER); 
78:	i.setLayoutParams(new ViewGroup.LayoutParams(50, 50)); 
-
82:	l.addView(i); 
-
89:	i.setImageDrawable(info.activityInfo.loadIcon(getPackageManager())); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getDrawable, setImageDrawable
47:	Drawable placeholder = target.getDrawable(); 
-
50:	target.setImageDrawable(drawable); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getVisibility, setImageDrawable, setVisibility
218:	mIconView.setImageDrawable(showIcon ? icon : null); 
-
220:	if (mIconView.getVisibility() != VISIBLE) { 
221:	mIconView.setVisibility(VISIBLE); 
-
224:	mIconView.setVisibility(GONE); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setImageDrawable, setScaleType
40:	mNotificationWallpaperImage = new ImageView(getContext()); 
41:	mNotificationWallpaperImage.setScaleType(ScaleType.CENTER); 
-
46:	mNotificationWallpaperImage.setImageDrawable(d); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getLayoutParams, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop
167:	LayoutParams param = mButton.getLayoutParams(); 
-
169:	- mButton.getPaddingLeft() - mButton.getPaddingRight(); 
-
171:	- mButton.getPaddingTop() - mButton.getPaddingBottom(); 
-
188:	mButton.setImageDrawable(drawable); 
-
190:	mButton.setImageBitmap(mThumb); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setImageDrawable
38:	convertView = new ImageView(parent.getContext()); 
-
41:	imageView.setImageDrawable(getItem(position)); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setImageDrawable
171:	imageView.setImageDrawable(drawable); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setImageDrawable, setVisibility
95:	iv.setVisibility(View.GONE); 
-
109:	iv.setVisibility(View.VISIBLE); 
110:	iv.setImageDrawable(item.getDrawable()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getVisibility, setImageDrawable, setVisibility
218:	mIconView.setImageDrawable(showIcon ? icon : null); 
-
220:	if (mIconView.getVisibility() != VISIBLE) { 
221:	mIconView.setVisibility(VISIBLE); 
-
224:	mIconView.setVisibility(GONE); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setBackgroundResource, setLayoutParams, setImageDrawable, setScaleType
59:	ImageView imageView = new ImageView(mContext); 
-
61:	imageView.setImageDrawable(Drawable.createFromPath(pictures.get(position).getPath())); 
62:	imageView.setLayoutParams(new Gallery.LayoutParams(150, 100)); 
63:	imageView.setScaleType(ImageView.ScaleType.FIT_XY); 
64:	imageView.setBackgroundResource(mGalleryItemBackground); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setImageDrawable, setVisibility
65:	i.setVisibility(View.VISIBLE); 
66:	i.setImageDrawable(image); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setImageDrawable
68:	mImageView.setImageDrawable(drawable); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getDrawable, setImageDrawable
55:	v.setImageDrawable(states); 
-
73:	final Drawable d = v.getDrawable(); 
-
91:	final Drawable d = v.getDrawable(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getConstantState, setImageDrawable
455:	icon = icon.getConstantState().newDrawable(getResources()); 
-
457:	holder.icon.setImageDrawable(icon); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getResources, setImageDrawable
49:	new BitmapDrawable(imageView.getResources(), bitmap) 
-
51:	imageView.setImageDrawable(td); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: addView, setLayoutParams, setImageDrawable, setScaleType
142:	ImageView view = new ImageView(mlAct); 
143:	view.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, 
-
145:	view.setScaleType(ScaleType.CENTER_INSIDE); 
146:	view.setImageDrawable(Drawable.createFromPath(mlFramePaths.get(position))); 
147:	((ViewPager) collection).addView(view); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getResources, getDrawable, setImageDrawable
39:	Resources resources = imageView.getResources(); 
-
47:	Drawable currentDrawable = imageView.getDrawable(); 
-
55:	imageView.setImageDrawable(transitionDrawable); 
-
60:	imageView.setImageDrawable(drawable); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: invalidate, setPadding, setImageDrawable
46:	iView = new ImageView(this); 
47:	iView.setImageDrawable(rectangle); 
-
57:	iView.setPadding((int) me.getRawX(), (int) me.getRawY(), 0, 0); 
58:	iView.invalidate(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getDrawable, setImageDrawable
141:	BitmapDownloaderTask task = new BitmapDownloaderTask(imageView); 
-
143:	imageView.setImageDrawable(downloadedDrawable); 
-
190:	Drawable drawable = imageView.getDrawable(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setTag, setImageDrawable
227:	imageView.setImageDrawable(crossFadeDrawable); 
-
229:	animator.addListener(new AnimatorListenerAdapter() { 
-
266:	imageView.setTag(to); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setId, setOnClickListener, setPadding, setTag, setImageDrawable
325:	mStatusButton = new ImageView(mContext); 
326:	mStatusButton.setId(id); 
327:	mStatusButton.setOnClickListener(mStatusButtonClickListener); 
328:	mStatusButton.setPadding(mStatusButtonPadding, 0, mStatusButtonPadding, 0); 
329:	mStatusButton.setScaleType(ScaleType.CENTER); 
-
332:	mStatusButton.setImageDrawable(icon); 
333:	mStatusButton.setTag(appId); 
334:	mStatusButton.setVisibility(View.VISIBLE); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getDrawable, setImageDrawable
51:	states.addState(new int[] {}, v.getDrawable()); 
52:	v.setImageDrawable(states); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setLayoutParams, setPadding, setImageDrawable, setMaxHeight, setMaxWidth
26:	mIcon = new ImageView(context); 
27:	mIcon.setPadding(5, 10, 20, 10); // 5px to the right 
28:	mIcon.setScaleType(ImageView.ScaleType.FIT_CENTER); 
29:	mIcon.setLayoutParams(new LayoutParams(90, 90)); 
-
31:	mIcon.setMaxHeight(72); 
32:	mIcon.setMaxWidth(72); 
33:	mIcon.setImageDrawable(iconifiedTextSelected.getIcon()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getVisibility, setImageDrawable, setVisibility
212:	mIconView.setImageDrawable(showIcon ? icon : null); 
-
214:	if (mIconView.getVisibility() != VISIBLE) { 
215:	mIconView.setVisibility(VISIBLE); 
-
218:	mIconView.setVisibility(GONE); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setBackgroundColor, setOnClickListener, setTag, setImageDrawable
26:	ImageButton imageButton = new ImageButton(this.getContext()); 
27:	imageButton.setTag(item.getKey()); 
-
30:	imageButton.setImageDrawable(drawable); 
31:	imageButton.setBackgroundColor(Color.TRANSPARENT); 
-
34:	imageButton.setOnClickListener(this); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setImageDrawable, setVisibility
33:	icon.setImageDrawable(item.getIcon()); 
34:	icon.setVisibility(item.getIcon() != null ? View.VISIBLE : View.GONE); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setImageDrawable, setVisibility
133:	view.setImageDrawable(drawable); 
134:	view.setVisibility(View.VISIBLE); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getResources, setImageDrawable
106:	mTarget.setImageDrawable(newDrawable); 
-
113:	mTarget.setImageDrawable(transition); 
-
134:	Resources resources = mTarget.getResources(); 
-
145:	Resources rsrc = mTarget.getResources(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getTag, setMinimumHeight, setTag, setImageDrawable
92:	BitmapDownloaderTask task = new BitmapDownloaderTask(url, imageView); 
93:	imageView.setImageDrawable(placeHolder); 
94:	imageView.setTag(new WeakReference<BitmapDownloaderTask>(task)); 
-
96:	imageView.setMinimumHeight(156); 
-
129:	Object ref = imageView.getTag(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setImageDrawable, setVisibility
133:	view.setImageDrawable(drawable); 
134:	view.setVisibility(View.VISIBLE); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setImageDrawable, setScaleType
35:	mLockScreenWallpaperImage = new ImageView(getContext()); 
36:	mLockScreenWallpaperImage.setScaleType(ScaleType.CENTER_CROP); 
-
40:	mLockScreenWallpaperImage.setImageDrawable(d); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: invalidate, setImageDrawable
71:	imageView.setImageDrawable(wallpaperDrawable); 
72:	imageView.invalidate(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setLayoutParams, setImageDrawable, setScaleType
56:	ImageView i = new ImageView(LayoutAnimation6.this); 
-
60:	i.setImageDrawable(info.activityInfo.loadIcon(getPackageManager())); 
61:	i.setScaleType(ImageView.ScaleType.FIT_CENTER); 
-
63:	i.setLayoutParams(new GridView.LayoutParams(w, w)); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setImageDrawable, setVisibility
85:	mLockIcon.setImageDrawable(d); 
86:	mLockIcon.setVisibility(View.VISIBLE); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setLayoutParams, setImageDrawable, setScaleType
57:	ImageView i = new ImageView(LayoutAnimation4.this); 
-
61:	i.setImageDrawable(info.activityInfo.loadIcon(getPackageManager())); 
62:	i.setScaleType(ImageView.ScaleType.FIT_CENTER); 
-
64:	i.setLayoutParams(new GridView.LayoutParams(w, w)); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setLayoutParams, setAdjustViewBounds, setImageDrawable, setScaleType
46:	myImageView = new ImageView(mContext); 
47:	myImageView.setLayoutParams(new GridView.LayoutParams(120, 120)); 
48:	myImageView.setAdjustViewBounds(false); 
49:	myImageView.setScaleType(ImageView.ScaleType.CENTER_CROP); 
-
56:	myImageView.setImageDrawable(drawableImage); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getVisibility, setImageDrawable, setVisibility
226:	mIconView.setImageDrawable(showIcon ? icon : null); 
-
228:	if (mIconView.getVisibility() != VISIBLE) { 
229:	mIconView.setVisibility(VISIBLE); 
-
232:	mIconView.setVisibility(GONE); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setLayoutParams, setAdjustViewBounds, setImageDrawable
199:	ImageView i = new ImageView(mContext); 
200:	i.setImageDrawable(getDrawable(position)); 
201:	i.setAdjustViewBounds(true); 
202:	i.setLayoutParams(new Gallery.LayoutParams(LayoutParams.WRAP_CONTENT, 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getBackground, setImageDrawable
146:	profilePicture.setImageDrawable(defaultProfilePicture); 
147:	profilePicture.getBackground().setAlpha(255); 
Full Snippet Info
6
CodeRank
Related ImageView setImageDrawable Questions & Answers:
Other ImageView setImageDrawable Examples
158:				// setting downloaded into image view
159:				my_image.setImageDrawable(Drawable.createFromPath(imagePath));
160:			}
161:	
162:		}

Read More

setImageDrawable Method Overview
Sets a drawable as the content of this ImageView.
See Also