ImageView setImageResource - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ImageView setImageResource method.

This code example shows how to use the following methods: setImageDrawable, setImageResource, setVisibility
        if (mMobileType != null) {
            mMobileType.setImageDrawable(null);
        } 
 
        if(mAirplane != null) {
            mAirplane.setImageDrawable(null);
        } 
 
        apply(); 
    } 
 
    // Run after each indicator change. 
    private void apply() { 
        if (mWifiGroup == null) return;
 
        if (mWifiVisible) {
            mWifi.setImageResource(mWifiStrengthId);
            mWifiActivity.setImageResource(mWifiActivityId);
 
            mWifiGroup.setContentDescription(mWifiDescription);

10
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setImageResource, setScaleType
        return position;
    } 
 
    @Override 
    public View getView(int position, View convertView, ViewGroup parent) {
        ImageView i = new ImageView(mContext);
        i.setImageResource(mImageIds[position]);
        i.setScaleType(ScaleType.CENTER_INSIDE);
        return i;
    } 
} 
Full Snippet Info
9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
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
Stop searching for code, let great code find you!  Add Codota to your java IDE
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: setBackgroundResource, setLayoutParams, setAdjustViewBounds, setImageResource
        public long getItemId(int position) {
            return position;
        } 
 
        public View getView(final int position, View convertView, ViewGroup parent) {
            ImageView i = new ImageView(mContext);
 
            i.setImageResource(THUMB_IDS[position]);
            i.setAdjustViewBounds(true);
            i.setLayoutParams(new Gallery.LayoutParams(
                    LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
            i.setBackgroundResource(android.R.drawable.picture_frame);
            return i;
        } 
 
    } 
 
} 
 
     
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

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 Code Examples for other Android ImageView Methods: