Best code examples for Android ImageView class (android.widget.ImageView)

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

Android ImageView 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: setLayoutParams, setPadding, setImageBitmap, setScaleType
92:	imageView = new ImageView(mContext); 
93:	imageView.setLayoutParams(new GridView.LayoutParams(50, 50)); 
94:	imageView.setScaleType(ImageView.ScaleType.FIT_XY); 
95:	imageView.setPadding(4, 4, 4, 4); 
-
101:	imageView.setImageBitmap(emotions.get(index.get(position))); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getHeight, getLayoutParams
115:	final ViewGroup.LayoutParams params = imageView.getLayoutParams(); 
-
118:	height = imageView.getHeight(); // Get actual image height 
-
121:	if (height <= 0) height = getImageViewFieldValue(imageView, "mMaxHeight"); // Check maxHeight parameter 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setImageResource, setScaleType
63:	ImageView i = new ImageView(mContext); 
64:	i.setImageResource(mImageIds[position]); 
65:	i.setScaleType(ScaleType.CENTER_INSIDE); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: getTag, invalidate, setImageBitmap
54:	if (path.equals(image.getTag())) { 
55:	image.setImageBitmap(bitmap); 
56:	image.invalidate(); 
Full Snippet Info
8
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: setBackgroundResource, setLayoutParams, setImageResource, setScaleType
120:	convertView = new ImageView(mContext); 
-
123:	imageView.setScaleType(ImageView.ScaleType.FIT_XY); 
124:	imageView.setLayoutParams(new Gallery.LayoutParams( 
-
129:	imageView.setBackgroundResource(mGalleryItemBackground); 
-
134:	imageView.setImageResource(mImageIds[position]); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setLayoutParams, setPadding, setAdjustViewBounds, setImageResource, setScaleType
66:	imageView = new ImageView(mContext); 
67:	imageView.setLayoutParams(new GridView.LayoutParams(45, 45)); 
68:	imageView.setAdjustViewBounds(false); 
69:	imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); 
70:	imageView.setPadding(8, 8, 8, 8); 
-
75:	imageView.setImageResource(mThumbIds[position]); 
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, setPadding, setImageBitmap, setScaleType
84:	ImageView iv = new ImageView(context); 
-
87:	iv.setImageBitmap(photo); 
88:	iv.setScaleType(ScaleType.CENTER); 
89:	iv.setPadding(0, 4, 4, 0); 
90:	iv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); 
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: setAlpha, setBackgroundColor, setImageBitmap
319:	ImageView v = new ImageView(context); 
-
321:	v.setAlpha((float) 0.7); 
322:	v.setBackgroundColor(backGroundColor); 
323:	v.setImageBitmap(bm); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: layout, getDrawable, setImageMatrix
262:	Drawable d = imageView.getDrawable(); 
-
391:	imageView.setImageMatrix(getViewMatrix()); 
-
399:	imageView.layout(parentLeft, parentTop, parentRight, parentBottom); 
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: setBackgroundColor, setLayoutParams, setScaleType
67:	ImageView i = new ImageView(this); 
68:	i.setBackgroundColor(0xFF000000); 
69:	i.setScaleType(ImageView.ScaleType.FIT_CENTER); 
70:	i.setLayoutParams(new ImageSwitcher.LayoutParams(LayoutParams.MATCH_PARENT, 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setId, setLayoutParams, setVisibility
79:	mImageView = new ImageView(context); 
-
82:	mImageView.setLayoutParams(imageViewLayoutParams); 
83:	mImageView.setId(INTERNAL_IMAGEVIEW_ID); 
84:	mImageView.setVisibility(View.VISIBLE); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setImageBitmap
44:	Bitmap roundedBitmap = roundCorners(bitmap, imageView, roundPixels); 
45:	imageView.setImageBitmap(roundedBitmap); 
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: getBackground, getHeight, getPaddingBottom, getPaddingTop, getTop
71:	int nextHeight = Math.max(mNext.getDrawable().getIntrinsicHeight() + mNext.getPaddingTop() 
72:	+ mNext.getPaddingBottom(), 
73:	mNext.getBackground().getMinimumHeight()); 
-
77:	assertEquals("Next incorrect height", nextHeight, mNext.getHeight()); 
-
80:	assertEquals("Next wrong top", (pauseHeight - nextHeight) / 2, mNext.getTop()); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setBackgroundColor, setPadding, setImageBitmap
50:	ImageView iv = new ImageView(mListView.getContext()); 
51:	iv.setBackgroundColor(mFloatBGColor); 
52:	iv.setPadding(0, 0, 0, 0); 
53:	iv.setImageBitmap(mFloatBitmap); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setLayoutParams, setImageResource, setScaleType
40:	ImageView imageView = new ImageView(_context); 
41:	imageView.setImageResource(imageIds[postion]); 
42:	imageView.setScaleType(ScaleType.FIT_XY); 
43:	imageView.setLayoutParams(new Gallery.LayoutParams(400, 400)); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setImageBitmap, setVisibility
142:	if (imgView != null && AsyncDrawable.getTask(imgView) == this) { //make sure the ImageView instance has not been reused for another page 
-
144:	imgView.setImageBitmap(result); 
145:	imgView.setVisibility(View.VISIBLE); 
Full Snippet Info
7
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: setImageBitmap
55:	ImageView image = new ImageView(TextGammaActivity.this); 
56:	image.setImageBitmap(b); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getId, setId, setLayoutParams
42:	ImageView icon = new ImageView( activity ); 
43:	icon.setId( 100 ); 
-
47:	labelParams.addRule( RelativeLayout.RIGHT_OF, icon.getId( ) ); 
-
57:	icon.setLayoutParams( iconParams ); 
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: getTag, invalidate, setImageBitmap
54:	if (path.equals(image.getTag())) { 
55:	image.setImageBitmap(bitmap); 
56:	image.invalidate(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setBackgroundResource, setLayoutParams, setImageBitmap, setScaleType
55:	imageView = new ImageView(mContext); 
-
64:	imageView.setLayoutParams(new Gallery.LayoutParams(unfocusedSize, unfocusedSize)); 
-
67:	imageView.setScaleType(ImageView.ScaleType.FIT_CENTER); 
68:	imageView.setBackgroundResource(mGalleryItemBackground); 
-
86:	imageView.setImageBitmap(bitMap); 
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: setLayoutParams, setPadding, setImageResource, setScaleType
54:	imageView = new ImageView(mContext); 
55:	imageView.setLayoutParams(new GridView.LayoutParams(85, 85)); 
56:	imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); 
57:	imageView.setPadding(8, 8, 8, 8); 
-
62:	imageView.setImageResource(mThumbIds[position]); 
Full Snippet Info
7
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: 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: setImageResource, setScaleType
63:	ImageView i = new ImageView(mContext); 
64:	i.setImageResource(mImageIds[position]); 
65:	i.setScaleType(ScaleType.CENTER_INSIDE); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getDrawable
114:	if (destination != null && destination.getDrawable() == temporaryDrawable) { 
115:	handler.post(new Runnable() { 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getAnimation, startAnimation, setImageBitmap
106:	imageView.setImageBitmap(bitmap); 
-
110:	imageView.startAnimation(animation); 
-
115:	Animation old = imageView.getAnimation(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setAlpha, setClickable, setEnabled, setFocusable
103:	mSetingsButton.setEnabled(checked); 
104:	mSetingsButton.setClickable(checked); 
105:	mSetingsButton.setFocusable(checked); 
-
107:	mSetingsButton.setAlpha(DISABLED_ALPHA); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setBackgroundResource, setLayoutParams, setAdjustViewBounds, setImageResource
137:	ImageView i = new ImageView(mContext); 
-
139:	i.setImageResource(THUMB_IDS[position]); 
140:	i.setAdjustViewBounds(true); 
141:	i.setLayoutParams(new Gallery.LayoutParams( 
-
143:	i.setBackgroundResource(android.R.drawable.picture_frame); 
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: setBackgroundColor, setImageResource, setScaleType
137:	mThumbnailView.setScaleType(ScaleType.CENTER); 
138:	mThumbnailView.setImageResource(resId); 
139:	mThumbnailView.setBackgroundColor(0x0); 
Full Snippet Info
7
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: 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
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: setPadding, setImageBitmap, setScaleType
170:	ImageView imageView = new ImageView(this); 
171:	imageView.setImageBitmap(bitmap); 
172:	imageView.setPadding(4, 4, 4, 4); 
173:	imageView.setScaleType(ScaleType.FIT_START); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setBackgroundDrawable, setImageBitmap
163:	final ImageView image_view = new ImageView(getContext()); 
-
173:	image_view.setBackgroundDrawable(new AlphaPatternDrawable((int) (5 * mDensity))); 
174:	image_view.setImageBitmap(getColorPreviewBitmap(getContext(), getValue())); 
Full Snippet Info
7
CodeRank
Related Android ImageView Questions & Answers:
Other Android ImageView Examples
15:	    super.onCreate(savedInstanceState);
16:	    setContentView(R.layout.activity_main);
17:	    ImageView button = (ImageView) findViewById(R.id.image);
18:	    InputStream resource = getResources().openRawResource(R.drawable.dog);
19:	    Bitmap bitmap = BitmapFactory.decodeStream(resource);
-
15:	    super.onCreate(savedInstanceState);
16:	    setContentView(R.layout.activity_main);
17:	    ImageView button = (ImageView) findViewById(R.id.image);
18:	    InputStream resource = getResources().openRawResource(R.drawable.dog);
19:	    Bitmap bitmap = BitmapFactory.decodeStream(resource);

Read More

15:	  private static final int REQUEST_CODE = 1;
16:	  private Bitmap bitmap;
17:	  private ImageView imageView;
18:	
19:	  /** Called when the activity is first created. */
-
22:	    super.onCreate(savedInstanceState);
23:	    setContentView(R.layout.main);
24:	    imageView = (ImageView) findViewById(R.id.result);
25:	  }
26:

Read More

14:	        
15:	        // Imageview to show
16:	        ImageView image = (ImageView) findViewById(R.id.image);
17:	        
18:	        // Image url
-
14:	        
15:	        // Imageview to show
16:	        ImageView image = (ImageView) findViewById(R.id.image);
17:	        
18:	        // Image url

Read More

19:	
20:			ImageView imageView = (ImageView) findViewById(R.id.full_image_view);
21:			imageView.setImageResource(imageAdapter.mThumbIds[position]);
22:		}
23:	
-
19:	
20:			ImageView imageView = (ImageView) findViewById(R.id.full_image_view);
21:			imageView.setImageResource(imageAdapter.mThumbIds[position]);
22:		}
23:

Read More

40:		 * */
41:		private class LoadProfileImage extends AsyncTask<String, Void, Bitmap> {
42:			ImageView bmImage;
43:	
44:			public LoadProfileImage(ImageView bmImage) {
-
42:			ImageView bmImage;
43:	
44:			public LoadProfileImage(ImageView bmImage) {
45:				this.bmImage = bmImage;
46:			}

Read More

20:	    // create a new ImageView for each item referenced by the Adapter
21:	    public View getView(int position, View convertView, ViewGroup parent) {
22:	        ImageView imageView;
23:	        if (convertView == null) {  // if it's not recycled, initialize some attributes
24:	            imageView = new ImageView(mContext);
-
22:	        ImageView imageView;
23:	        if (convertView == null) {  // if it's not recycled, initialize some attributes
24:	            imageView = new ImageView(mContext);
25:	            imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
26:	            imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
-
27:	            imageView.setPadding(8, 8, 8, 8);
28:	        } else {
29:	            imageView = (ImageView) convertView;
30:	        }
31:

Read More

See Code Examples for Android ImageView Methods: