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
This code example shows how to use the following methods: setImageResource, setScaleType
This code example shows how to use the following methods: setBackgroundResource, setLayoutParams, setImageResource, setScaleType
        } 
 
        public View getView(int position, View convertView, ViewGroup parent) {
            ImageView imageView;
            if (convertView == null) {
                convertView = new ImageView(mContext);
 
                imageView = (ImageView) convertView;
                imageView.setScaleType(ImageView.ScaleType.FIT_XY);
                imageView.setLayoutParams(new Gallery.LayoutParams(
                        (int) (ITEM_WIDTH * mDensity + 0.5f),
                        (int) (ITEM_HEIGHT * mDensity + 0.5f)));
             
                // The preferred Gallery item background 
                imageView.setBackgroundResource(mGalleryItemBackground);
            } else { 
                imageView = (ImageView) convertView;
            } 
 
            imageView.setImageResource(mImageIds[position]);

8
CodeRank
This code example shows how to use the following methods: setLayoutParams, setPadding, setAdjustViewBounds, setImageResource, setScaleType
This code example shows how to use the following methods: setLayoutParams, setPadding, setImageBitmap, setScaleType
	// Create the view for each user status 
	// [FIXME] Should be put as an XML file (possible?) 
	 
	private View makeUserStatusView(Context context, TwitterEntry entry) {
 
    	ImageView iv = new ImageView(context);
    	Bitmap photo = BitmapCache.getInstance().get(entry.getUser().getProfileImageURL());
 
    	iv.setImageBitmap(photo);
    	iv.setScaleType(ScaleType.CENTER);
    	iv.setPadding(0, 4, 4, 0);
    	iv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
	 
    	TextView tv = new TextView(context);
    	tv.setText(entry.getUser().getName() + ": " + entry.getText());
    	tv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
	 
    	LinearLayout layout = new LinearLayout(context);
    	layout.setOrientation(LinearLayout.HORIZONTAL);
    	layout.setPadding(4, 2, 4, 2);
Full Snippet Info
8
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 Code Examples for other Android ImageView Methods: