android.graphics.drawable.Drawable.setLevel()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(412)

本文整理了Java中android.graphics.drawable.Drawable.setLevel()方法的一些代码示例,展示了Drawable.setLevel()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Drawable.setLevel()方法的具体详情如下:
包路径:android.graphics.drawable.Drawable
类名称:Drawable
方法名:setLevel

Drawable.setLevel介绍

暂无

代码示例

代码示例来源:origin: facebook/litho

@Override
protected boolean onLevelChange(int level) {
 return mDrawable != null && mDrawable.setLevel(level);
}

代码示例来源:origin: facebook/litho

@Override
protected boolean onLevelChange(int level) {
 return mDrawable.setLevel(level);
}

代码示例来源:origin: facebook/litho

@Override
protected boolean onLevelChange(int level) {
 return mDrawable.setLevel(level);
}

代码示例来源:origin: rey5137/material

@Override
protected boolean onLevelChange(int level) {
  return mDrawable != null && mDrawable.setLevel(level);
}

代码示例来源:origin: DreaminginCodeZH/MaterialProgressBar

@Override
protected boolean onLevelChange(int level) {
  if (mLastDrawable != null) {
    return mLastDrawable.setLevel(level);
  }
  if (mCurrDrawable != null) {
    return mCurrDrawable.setLevel(level);
  }
  return false;
}

代码示例来源:origin: seven332/EhViewer

protected boolean onLevelChange(int level) {
 return this.mDrawable.setLevel(level);
}

代码示例来源:origin: stackoverflow.com

Resources res = getResources();
ScaleDrawable sd = (ScaleDrawable) res.getDrawable(R.drawable.logo2);
Drawable d = sd.getDrawable();

d.setLevel(1);

ImageView iv = new ImageView(this);
iv.setImageDrawable(sd);
iv.setAdjustViewBounds(true); 
iv.setLayoutParams(new Gallery.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

setContentView(iv);

代码示例来源:origin: ZieIony/Carbon

@Override
protected boolean onLevelChange(int level) {
  boolean changed = false;
  final ChildDrawable[] array = mLayerState.mChildren;
  final int N = mLayerState.mNum;
  for (int i = 0; i < N; i++) {
    final Drawable dr = array[i].mDrawable;
    if (dr != null && dr.setLevel(level)) {
      refreshChildPadding(i, array[i]);
      changed = true;
    }
  }
  if (changed) {
    updateLayerBounds(getBounds());
  }
  return changed;
}

代码示例来源:origin: android-hacker/VirtualXposed

void fixIconImage(Resources resources, RemoteViews remoteViews, boolean hasIconBitmap, Notification notification) {
  if (remoteViews == null || notification.icon == 0) return;
  if (!mNotificationCompat.isSystemLayout(remoteViews)) {
    return;
  }
  try {
    //noinspection deprecation
    int id = R_Hide.id.icon.get();
    //only fake small icon
    if (!hasIconBitmap && notification.largeIcon == null) {
      Drawable drawable = resources.getDrawable(notification.icon);
      drawable.setLevel(notification.iconLevel);
      Bitmap bitmap = drawableToBitMap(drawable);
      remoteViews.setImageViewBitmap(id, bitmap);
      //emui
      if(OSUtils.getInstance().isEmui()) {
        if (notification.largeIcon == null) {
          notification.largeIcon = bitmap;
        }
      }
    }
  } catch (Exception e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: ZieIony/Carbon

clone.setLayoutDirection(dr.getLayoutDirection());
  clone.setBounds(dr.getBounds());
  clone.setLevel(dr.getLevel());
} else {
  clone = null;

代码示例来源:origin: stackoverflow.com

//progress is between 0 and 100 so set level of drawable to progress * 100
Drawable batteryProgressD = batteryProgressBar.getProgressDrawable();
batteryProgressD.setLevel(progress*100);
batteryProgressBar.setProgress(progress);

代码示例来源:origin: LuckyJayce/LargeImage

d.setVisible(getWindowVisibility() == VISIBLE && isShown(), true);
d.setLevel(mLevel);
mDrawableWidth = d.getIntrinsicWidth();
mDrawableHeight = d.getIntrinsicHeight();

代码示例来源:origin: LuckyJayce/LargeImage

d.setVisible(visible, true);
d.setLevel(mLevel);
mDrawableWidth = d.getIntrinsicWidth();
mDrawableHeight = d.getIntrinsicHeight();

代码示例来源:origin: DreaminginCodeZH/MaterialProgressBar

d.setDither(mDrawableContainerState.mDither);
d.setState(getState());
d.setLevel(getLevel());
d.setBounds(getBounds());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {

代码示例来源:origin: stackoverflow.com

Drawable d = getDrawable();
 if (d != null)
 {
   // Translate canvas so a indeterminate circular progress bar with
   // padding rotates properly in its animation
   canvas.save();
   canvas.translate(getPaddingLeft(), getPaddingTop());
   long time = getDrawingTime();
   // I'm not sure about the +1.
   float prog = (float)(time % ANIM_PERIOD+1) / (float)ANIM_PERIOD; 
   int level = (int)(MAX_LEVEL * prog);
   d.setLevel(level);
   d.draw(canvas);
   canvas.restore();
   ViewCompat.postInvalidateOnAnimation(this);
 }

代码示例来源:origin: heinrichreimer/material-drawer

@Override
  public void set(Drawable object, Integer value) {
    object.setLevel(value);
  }
};

代码示例来源:origin: fookwood/Launcher3

public void applyState() {
  if (mCenterDrawable != null) {
    mCenterDrawable.setLevel(Math.max(mInfo.installProgress, 0));
  }
}

代码示例来源:origin: com.albedinsky.android/ui

/**
 * If one the drawable layers of the wrapped drawable is {@link android.R.id#progress} this will
 * update its current level to the specified one.
 *
 * @param level The level to be set to the progress layer (if presented).
 * @return {@code True} if the given level has been set and it actually changed to the current
 * level of the progress layer, {@code false} otherwise.
 */
private boolean updateProgressDrawableLevel(int level) {
  final Drawable progressDrawable = ((LayerDrawable) mDrawable).findDrawableByLayerId(android.R.id.progress);
  return progressDrawable != null && progressDrawable.setLevel(level);
}

代码示例来源:origin: NordicSemiconductor/Android-nRF-Toolbox

@Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View view = convertView;
    if (view == null) {
      view = mInflater.inflate(R.layout.app_file_browser_item, parent, false);
    }

    final TextView item = (TextView) view;
    item.setText(mResources.getStringArray(R.array.dfu_app_file_browser)[position]);
    item.getCompoundDrawablesRelative()[0].setLevel(position);
    return view;
  }
}

代码示例来源:origin: yydcdut/RxMarkdown

private static void copyProperties(Drawable to, Drawable from) {
  if (from == null || to == null || to == from) {
    return;
  }
  to.setBounds(from.getBounds());
  to.setChangingConfigurations(from.getChangingConfigurations());
  to.setLevel(from.getLevel());
  to.setVisible(from.isVisible(), false);
  to.setState(from.getState());
}

相关文章