ImageView setImageDrawable - 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 setImageDrawable method.

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: getTag, setTag, getDrawable, setImageDrawable
    } 
 
    // protected for testing purposes 
    protected void loadBitmapAsynchronously(T octo, ImageView thumbImageView,
        String tempThumbnailImageFileName) {
        if (thumbImageView.getTag() != null
            && thumbImageView.getTag().equals(tempThumbnailImageFileName)) {
            return; 
        } 
 
        if (cancelPotentialWork(tempThumbnailImageFileName, thumbImageView)) {
            final BitmapWorkerTask task = new BitmapWorkerTask(thumbImageView,
                octo);
            task.fileName = tempThumbnailImageFileName;
            final AsyncDrawable asyncDrawable = new AsyncDrawable(getContext()
                .getResources(), task);
            thumbImageView.setImageDrawable(asyncDrawable);
            thumbImageView.setTag(tempThumbnailImageFileName);
            int width = Math.round(convertDpToPixel(IMG_WIDTH, getContext()));
            int height = width;

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: setId, setTag, setImageDrawable, setScaleType, setVisibility
     * Sets up the status icon, creating it if necessary. 
     */ 
    public void setStatusButton(Drawable icon, int id, long appId) {
        if (icon != null) {
            if (mStatusButton == null) {
                mStatusButton = new ImageView(mContext);
                mStatusButton.setId(id);
                mStatusButton.setScaleType(ScaleType.CENTER);
                addView(mStatusButton);
            } 
            mStatusButton.setImageDrawable(icon);
            mStatusButton.setTag(appId);
            mStatusButton.setVisibility(View.VISIBLE);
        } else { 
            if (mStatusButton != null) {
                mStatusButton.setVisibility(View.GONE);
            } 
        } 
    } 
 
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: clearAnimation, getAnimation, getContext, getTag, setTag
 
    ImageView view = getView();
    if (view == null)
      return; 
 
    if (!equals(view.getTag()))
      return; 
 
    view.setTag(null);
    if (result != null) {
      if (fadeIn && view.getAnimation() == null)
        view.startAnimation(AnimationUtils.loadAnimation(view.getContext(),
            android.R.anim.fade_in));
      view.setImageBitmap(result);
    } else { 
      view.setImageDrawable(null);
      view.clearAnimation();
    } 
  } 
} 

8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related ImageView setImageDrawable Questions & Answers:

Other ImageView setImageDrawable Examples

158:				// setting downloaded into image view
159:				my_image.setImageDrawable(Drawable.createFromPath(imagePath));
160:			}
161:	
162:		}

Read More

setImageDrawable Method Overview
Sets a drawable as the content of this ImageView.
See Code Examples for other Android ImageView Methods: