Android ImageView - top ranked examples from Open Source projects

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

This code example shows how to use the following methods: getVisibility, setImageDrawable, setVisibility
        if (mIconView == null) {
            insertIconView(); 
        } 
 
        if (icon != null || mPreserveIconSpacing) {
            mIconView.setImageDrawable(showIcon ? icon : null);
 
            if (mIconView.getVisibility() != VISIBLE) {
                mIconView.setVisibility(VISIBLE);
            } 
        } else { 
            mIconView.setVisibility(GONE);
        } 
    } 
 
    @Override 
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        if (mIconView != null && mPreserveIconSpacing) {
            // Enforce minimum icon spacing 
            ViewGroup.LayoutParams lp = getLayoutParams();
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: 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: setLayoutParams, setPadding, setImageBitmap, setScaleType
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: getHeight, getLayoutParams
	 */ 
	@Override 
	public int getHeight() { 
		ImageView imageView = imageViewRef.get();
		if (imageView != null) {
			final ViewGroup.LayoutParams params = imageView.getLayoutParams();
			int height = 0;
			if (checkActualViewSize && params != null && params.height != ViewGroup.LayoutParams.WRAP_CONTENT) {
				height = imageView.getHeight(); // Get actual image height
			} 
			if (height <= 0 && params != null) height = params.height; // Get layout height parameter
			if (height <= 0) height = getImageViewFieldValue(imageView, "mMaxHeight"); // Check maxHeight parameter
			return height;
		} 
		return 0; 
	} 
 
	@Override 
	public ViewScaleType getScaleType() { 
		ImageView imageView = imageViewRef.get();
Full Snippet Info
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: 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

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: