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

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

ImageView setScaleType examples from Open Source projects
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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: setLayoutParams, setMinimumHeight, setMinimumWidth, setImageResource, setScaleType
72:	ImageView view = new ImageView(mActivity); 
73:	view.setImageResource(image); 
74:	view.setMinimumWidth(mItemSize); 
75:	view.setMinimumHeight(mItemSize); 
76:	view.setScaleType(ScaleType.CENTER); 
-
78:	view.setLayoutParams(lp); 
79:	return new PieItem(view, l); 
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: setAdjustViewBounds, setImageBitmap, setScaleType
81:	imageView = new ImageView( context ); 
82:	imageView.setAdjustViewBounds( false ); 
83:	imageView.setScaleType( ImageView.ScaleType.MATRIX ); 
-
85:	imageView.setImageBitmap( bitmap ); 
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: setLayoutParams, setTag, setImageResource, setScaleType
73:	imageView = new ImageView(mContext); 
-
75:	imageView.setLayoutParams(new GridView.LayoutParams(85, 85)); 
-
77:	imageView.setScaleType(ImageView.ScaleType.CENTER); 
-
82:	imageView.setImageResource(mImageIds[position]); 
-
84:	imageView.setTag("[" + position + "]"); 
-
86:	imageView.setTag("[" + (position + 1) + "]"); 
-
88:	imageView.setTag("[" + (position + 2) + "]"); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setAdjustViewBounds, setScaleType
425:	imageView.setAdjustViewBounds(false); 
426:	imageView.setScaleType(ScaleType.CENTER); 
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: setLayoutParams, setScaleType
95:	mImage = new ImageView(mContext); 
96:	mImage.setScaleType(ScaleType.FIT_XY); 
97:	mImage.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setBackgroundResource, setLayoutParams, setImageResource, setScaleType
45:	ImageView imageView = new ImageView(context); 
46:	imageView.setImageResource(imageIDs[position]); 
47:	imageView.setScaleType(ImageView.ScaleType.FIT_XY); 
48:	imageView.setLayoutParams(new Gallery.LayoutParams(150, 120)); 
49:	imageView.setBackgroundResource(itemBackground); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setBackgroundResource, setLayoutParams, setImageResource, setScaleType
52:	ImageView i = new ImageView(mContext); 
-
54:	i.setImageResource(mImageIds[position]); 
55:	i.setLayoutParams(new Gallery.LayoutParams(150, 100)); 
56:	i.setScaleType(ImageView.ScaleType.FIT_XY); 
57:	i.setBackgroundResource(galleryItemBackground); 
Full Snippet Info
7
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: setBackgroundResource, setLayoutParams, setImageBitmap, setScaleType
69:	ImageView imageView = new ImageView(mContext); 
-
71:	imageView.setImageBitmap( bitmaps[position] ); 
72:	imageView.setLayoutParams(new Gallery.LayoutParams(250, 200)); 
73:	imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); 
74:	imageView.setBackgroundResource(mGalleryItemBackground); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setLayoutParams, setPadding, setImageBitmap, setScaleType
76:	imageView = new ImageView(mContext); 
77:	imageView.setLayoutParams(new GridView.LayoutParams(150, 150)); 
78:	imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); 
79:	imageView.setPadding(1, 1, 1, 1); 
-
88:	imageView.setImageBitmap(BitmapFactory.decodeFile(DecodeBitmaps.thumbPosition.get(position))); 
-
93:	imageView.setImageBitmap(BitmapFactory.decodeFile(DecodeBitmaps.thumbPosition.get(position),opt)); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setAdjustViewBounds, setImageBitmap, setScaleType
141:	imageView = new ImageView( context ); 
142:	imageView.setAdjustViewBounds( false ); 
143:	imageView.setScaleType( ImageView.ScaleType.MATRIX ); 
-
145:	imageView.setImageBitmap( bitmap ); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setLayoutParams, setMinimumHeight, setMinimumWidth, setOnClickListener, setImageResource
186:	ImageView view = new ImageView(mContext); 
187:	view.setImageResource(image); 
188:	view.setMinimumWidth(mItemSize); 
189:	view.setMinimumHeight(mItemSize); 
190:	view.setScaleType(ScaleType.CENTER); 
-
192:	view.setLayoutParams(lp); 
193:	view.setOnClickListener(this); 
194:	return new PieItem(view, mContext, l, name, lesser); 
Full Snippet Info
6
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: setLayoutParams, setImageResource, setScaleType
102:	ImageView i = new ImageView(mContext); 
103:	i.setLayoutParams(lp); 
104:	i.setImageResource(images.get(position)); 
105:	i.setScaleType(ImageView.ScaleType.FIT_CENTER); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getContext, setLayoutParams, setScaleType
418:	ImageView v = new ImageView(context); 
419:	v.setScaleType(ScaleType.FIT_XY); 
420:	int w = ImageUtils.getDPI(width, (Activity)v.getContext()); 
421:	int h = ImageUtils.getDPI(height, (Activity)v.getContext()); 
-
423:	v.setLayoutParams(new LayoutParams(w, h)); 
-
425:	imageLoader.displayImage(mediaTagUrl, v); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setBackgroundResource, setLayoutParams, setImageResource, setScaleType
38:	ImageView i = new ImageView(mContext); 
39:	i.setImageResource(mImageIds[position]); 
40:	i.setLayoutParams(new Gallery.LayoutParams(300, 200)); 
41:	i.setScaleType(ImageView.ScaleType.FIT_XY); 
42:	i.setBackgroundResource(mGalleryItemBackground); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setLayoutParams, getDrawable, setImageResource, setScaleType
169:	ImageView i = new ImageView(mContext); 
170:	i.setImageResource(mImageIds[position]); 
171:	i.setLayoutParams(new CoverFlow.LayoutParams(130, 130)); 
172:	i.setScaleType(ImageView.ScaleType.CENTER_INSIDE); 
-
175:	BitmapDrawable drawable = (BitmapDrawable) i.getDrawable(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setBackgroundResource, setLayoutParams, setImageResource, setScaleType
54:	ImageView i = new ImageView(mContext); 
-
56:	i.setImageResource(mImageIds[position]); 
57:	i.setLayoutParams(new Gallery.LayoutParams(150, 100)); 
58:	i.setScaleType(ImageView.ScaleType.FIT_XY); 
59:	i.setBackgroundResource(mGalleryItemBackground); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setLayoutParams, setScaleType
61:	ImageView i = new ImageView(context); 
62:	i.setScaleType(ImageView.ScaleType.FIT_CENTER); 
63:	i.setLayoutParams(new ImageSwitcher.LayoutParams( 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setBackgroundColor, setLayoutParams, setScaleType
19:	ImageView imageView = new ImageView(ctx); 
20:	imageView.setBackgroundColor(0xFF000000); 
21:	imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); 
22:	imageView.setLayoutParams(new 
Full Snippet Info
6
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: 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: scrollTo, setImageURI, setScaleType
183:	imageView.setScaleType(ScaleType.CENTER_INSIDE); 
184:	imageView.scrollTo(0, 0); 
185:	imageView.setImageURI(targetUri); 
186:	imageView.setScaleType(ScaleType.MATRIX); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setImageDrawable, setScaleType, setVisibility
583:	mPresenceIcon = new ImageView(mContext); 
-
586:	mPresenceIcon.setImageDrawable(icon); 
587:	mPresenceIcon.setScaleType(ScaleType.CENTER); 
588:	mPresenceIcon.setVisibility(View.VISIBLE); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setLayoutParams, setImageDrawable, setScaleType
199:	sep.setLayoutParams(makeDividerLayoutParams()); 
-
204:	ImageView result = new ImageView(mContext); 
205:	result.setImageDrawable(mSeparatorDrawable); 
206:	result.setScaleType(ImageView.ScaleType.FIT_XY); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setBackgroundResource, setLayoutParams, setImageResource, setScaleType
168:	ImageView imageView = new ImageView(mContext); 
169:	imageView.setImageResource(mImageIds[position]); 
170:	imageView.setLayoutParams(new Gallery.LayoutParams(144, 180)); 
171:	imageView.setScaleType(ImageView.ScaleType.FIT_XY); 
172:	imageView.setBackgroundResource(mGalleryItemBackground); 
Full Snippet Info
6
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: 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: setBackgroundColor, setLayoutParams, setScaleType
177:	ImageView tempImage = new ImageView(this); 
178:	tempImage.setBackgroundColor(0xFF000000); 
179:	tempImage.setScaleType(ImageView.ScaleType.FIT_CENTER); 
180:	tempImage.setLayoutParams(new ImageSwitcher.LayoutParams( 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setLayoutParams, setImageDrawable, setScaleType
56:	ImageView i = new ImageView(LayoutAnimation5.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, 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: 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: setBackgroundColor, setId, setAdjustViewBounds, setImageResource, setScaleType
57:	imageView = new ImageButton(this.context); 
58:	imageView.setId(buttonIds[position]); 
-
60:	imageView.setAdjustViewBounds(true); 
61:	imageView.setBackgroundColor(Color.BLACK); 
62:	imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); 
-
68:	imageView.setImageResource(cardImages[position]); 
Full Snippet Info
6
CodeRank
Related ImageView setScaleType Questions & Answers:
Other ImageView setScaleType Examples
59:					imageWidth);
60:	
61:			imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
62:			imageView.setLayoutParams(new GridView.LayoutParams(imageWidth,
63:					imageWidth));

Read More

46:			ImageView imageView = new ImageView(mContext);
47:	        imageView.setImageResource(mThumbIds[position]);
48:	        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
49:	        imageView.setLayoutParams(new GridView.LayoutParams(70, 70));
50:	        return imageView;

Read More

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 {

Read More

setScaleType Method Overview
Controls how the image should be resized or moved to match the size of this ImageView.
See Also