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

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

ImageView setImageResource examples from Open Source projects
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: 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: 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: 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: 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: setOnClickListener, setImageResource
52:	ImageButton button = new ImageButton(this); 
53:	button.setImageResource(getIntent().getIntExtra("moodimg", 0)); 
54:	button.setOnClickListener(this); 
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: setImageResource
72:	mImageView.setImageResource(resId); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setLayoutParams, setOnClickListener, setPadding, setImageResource
31:	b = new ImageButton(context); 
32:	b.setLayoutParams(params); 
33:	b.setOnClickListener(new OnClickListener() { 
-
39:	b.setImageResource(myText); 
-
42:	getTheme().applyNormal1(b); 
-
45:	b.setPadding(p, p, p, p); 
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: setImageResource, setImageURI
205:	v.setImageResource(Integer.parseInt(value)); 
-
207:	v.setImageURI(Uri.parse(value)); 
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: getLayoutParams, setLayoutParams, setImageResource
66:	FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) imageView.getLayoutParams(); 
-
69:	imageView.setLayoutParams(params); 
70:	imageView.setImageResource(item); 
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: setImageResource
71:	image.setImageResource(R.drawable.icon); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setBackgroundResource, setLayoutParams, setPadding, setImageResource
125:	ImageView nreLogo = new ImageView(page); 
126:	nreLogo.setBackgroundResource(R.drawable.bg_white); 
127:	nreLogo.setImageResource(R.drawable.powered_by_nre); 
128:	nreLogo.setPadding(0, 5, 0, 5); 
129:	nreLogo.setLayoutParams(Page.paramsWithLine); 
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: addView, setImageResource
52:	ImageView view = new ImageView(ViewPagerActivity.this); 
53:	view.setImageResource(pics[position]); 
-
55:	((ViewPager) collection).addView(view, 0); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setImageResource, setImageURI
205:	v.setImageResource(Integer.parseInt(value)); 
-
207:	v.setImageURI(Uri.parse(value)); 
Full Snippet Info
7
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: getBackground, setImageResource
181:	final int sliderWidth = mSlider.getBackground().getIntrinsicWidth() - 2 * SHADOW_PADDING; 
-
186:	mSlider.setImageResource(newTab.getActiveIconResource()); 
Full Snippet Info
6
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: setImageResource
155:	mIcon.setImageResource(resId); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setOnClickListener, setImageResource, setVisibility
88:	action.setImageResource(iconResourceId); 
-
92:	action.setVisibility(onClickListener != null ? View.VISIBLE : View.GONE); 
-
95:	action.setOnClickListener(onClickListener); 
Full Snippet Info
6
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: setOnClickListener, setImageResource, setVisibility
57:	mLogoView.setImageResource(resId); 
58:	mLogoView.setVisibility(View.VISIBLE); 
59:	mLogoView.setOnClickListener(onClickListener); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: startAnimation, setImageResource
23:	view.setImageResource(toImageRes); 
-
26:	view.startAnimation(fadeIn); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setLayoutParams, setImageResource
116:	imageView = new ImageView(mContext); 
117:	imageView.setLayoutParams(new GridView.LayoutParams(mIconSize, mIconSize)); 
-
121:	imageView.setImageResource(mThumbs.get(position)); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setImageResource
104:	final ImageView myView = new ImageView(mActivity); 
105:	myView.setImageResource(mToastResourcesMap[whichActicity]); 
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, setOnClickListener, setPadding, setImageResource
30:	b = new ImageButton(context); 
31:	b.setLayoutParams(params); 
32:	b.setOnClickListener(new OnClickListener() { 
-
38:	b.setImageResource(myText); 
-
41:	getTheme().applyNormal1(b); 
-
44:	b.setPadding(p, p, p, p); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setImageResource, setVisibility
147:	mMobileType.setImageResource(mMobileTypeId); 
-
164:	mMobileType.setVisibility( 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setColorFilter, setImageResource
28:	ImageView icon = new ImageView(context); 
29:	icon.setImageResource(inode.getImageResource()); 
-
32:	icon.setColorFilter(0xff888888, Mode.SRC_ATOP); //argb 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setImageResource, setScaleType, setVisibility
46:	customSpashScreen = new ImageView(this); 
47:	customSpashScreen.setImageResource(super.getIntegerProperty(C_CUSTOM_SPLASH_SCREEN, 0)); 
48:	customSpashScreen.setScaleType(ScaleType.CENTER_CROP); 
-
59:	customSpashScreen.setImageResource(super.getIntegerProperty(C_CUSTOM_SPLASH_SCREEN, 0)); 
60:	customSpashScreen.setVisibility(View.VISIBLE); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setLayoutParams, setImageResource, setScaleType
37:	ImageView imageView = new ImageView(mContext); 
-
39:	imageView.setImageResource(mImageIds[position]); 
40:	imageView.setLayoutParams(new Gallery.LayoutParams(150, 100)); 
41:	imageView.setScaleType(ImageView.ScaleType.FIT_XY); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setPadding, setImageResource
59:	ImageView i = new ImageView(myContext); 
60:	i.setPadding(0, iconPadding, iconPadding * 2, iconPadding); 
61:	i.setImageResource(iconId); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setLayoutParams, setImageResource
20:	mProgressImageView = new ImageView(context); 
-
24:	mProgressImageView.setLayoutParams(lp); 
25:	mProgressImageView.setImageResource(progressDrawables[0]); 
-
28:	new SceneAnimation(mProgressImageView, progressDrawables, mAnimationDuration); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setImageResource, setImageURI
206:	v.setImageResource(Integer.parseInt(value)); 
-
208:	v.setImageURI(Uri.parse(value)); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setContentDescription, setImageResource
83:	mSyncStatusIcon.setImageResource(getSyncStatusIcon(status)); 
84:	mSyncStatusIcon.setContentDescription(getSyncContentDescription(mStatus)); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setBackgroundColor, setOnClickListener, setImageResource
82:	final ImageButton iconView = new ImageButton(context); 
83:	iconView.setOnClickListener(new OnClickListener() { 
-
103:	iconView.setImageResource(android.R.drawable.radiobutton_on_background); 
-
105:	iconView.setImageResource(android.R.drawable.radiobutton_off_background); 
-
107:	iconView.setBackgroundColor(Color.TRANSPARENT); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setImageResource, setImageURI
221:	v.setImageResource(Integer.parseInt(value)); 
-
223:	v.setImageURI(Uri.parse(value)); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setImageResource, setImageURI
221:	v.setImageResource(Integer.parseInt(value)); 
-
223:	v.setImageURI(Uri.parse(value)); 
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 setImageResource Questions & Answers:
Other ImageView setImageResource Examples
51:	        TextView txtCount = (TextView) convertView.findViewById(R.id.counter);
52:	         
53:	        imgIcon.setImageResource(navDrawerItems.get(position).getIcon());        
54:	        txtTitle.setText(navDrawerItems.get(position).getTitle());
55:

Read More

43:	        {
44:	            queuePhoto(url, imageView);
45:	            imageView.setImageResource(loader);
46:	        }
47:	    }

Read More

53:	        txtTitle = (TextView) convertView.findViewById(R.id.txtTitle);
54:	        
55:	        imgIcon.setImageResource(spinnerNavItem.get(position).getIcon());
56:	        imgIcon.setVisibility(View.GONE);
57:	        txtTitle.setText(spinnerNavItem.get(position).getTitle());
-
71:	        txtTitle = (TextView) convertView.findViewById(R.id.txtTitle);
72:	        
73:	        imgIcon.setImageResource(spinnerNavItem.get(position).getIcon());        
74:	        txtTitle.setText(spinnerNavItem.get(position).getTitle());
75:	        return convertView;

Read More

30:	        }
31:	
32:	        imageView.setImageResource(mThumbIds[position]);
33:	        return imageView;
34:	    }

Read More

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