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

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

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

Drawable.getLevel介绍

暂无

代码示例

代码示例来源:origin: square/assertj-android

public S hasLevel(int level) {
 isNotNull();
 int actualLevel = actual.getLevel();
 assertThat(actualLevel) //
   .overridingErrorMessage("Expected level <%s> but was <%s>.", level, actualLevel) //
   .isEqualTo(level);
 return myself;
}

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

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

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

@Override
public Integer get(Drawable object) {
  return object.getLevel();
}

代码示例来源:origin: com.squareup.assertj/assertj-android

public S hasLevel(int level) {
 isNotNull();
 int actualLevel = actual.getLevel();
 assertThat(actualLevel) //
   .overridingErrorMessage("Expected level <%s> but was <%s>.", level, actualLevel) //
   .isEqualTo(level);
 return myself;
}

代码示例来源:origin: mtotschnig/MyExpenses

iconView.setImageLevel(icon.getLevel());
iconView.setImageDrawable(icon);
iconContainer.setVisibility(View.VISIBLE);

代码示例来源:origin: Yellow5A5/BoilingLoadingView

private void setbubble(List<Bubble> list, Canvas canvas) {
  if (list.size() == 0) {
    return;
  }
  for (int i = 0; i < list.size(); i++) {
    Bubble bubble = list.get(i);
    if (bubble.getCenterY() < mHeight - mHeight * mDrawable.getLevel() / 10000f) {
      mBubbleList.remove(bubble);
      addBubble(0);
    } else {
      bubble.beenLargen();
      bubble.beenRise();
    }
    canvas.drawCircle(bubble.getCenterX(), bubble.getCenterY(), bubble.getRadius(), mPaint);
  }
  invalidate();
}

代码示例来源:origin: jbruchanov/AnUitor

data.put("IntrinsicWidth", d.getIntrinsicWidth());
data.put("IntrinsicHeight", d.getIntrinsicHeight());
data.put("Level", d.getLevel());
data.put("MinimumWidth", d.getMinimumWidth());
data.put("MinimumHeight", d.getMinimumHeight());

代码示例来源:origin: 66668/DropDownMenuplus

private void switchTab(int pos) {
  TextView tv = getChildAtCurPos(pos);
  Drawable drawable = tv.getCompoundDrawables()[2];
  int level = drawable.getLevel();
  if (mOnItemClickListener != null) {
    mOnItemClickListener.onItemClick(tv, pos, level == 1);
  }
  if (mLastIndicatorPosition == pos) {
    // 点击同一个条目时
    tv.setTextColor(level == 0 ? mTabSelectedColor : mTabDefaultColor);
    drawable.setLevel(1 - level);
    return;
  }
  mCurrentIndicatorPosition = pos;
  resetPos(mLastIndicatorPosition);
  //highLightPos(pos);
  tv.setTextColor(mTabSelectedColor);
  tv.getCompoundDrawables()[2].setLevel(1);
  mLastIndicatorPosition = pos;
}

代码示例来源: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());
}

代码示例来源:origin: Yellow5A5/BoilingLoadingView

@Override
protected void onDraw(Canvas canvas) {
  super.onDraw(canvas);
  if (mDrawable == null)
    return;
  if (!isFinishMeasure) {
    mWidth = getWidth();
    mHeight = getHeight();
    isFinishMeasure = true;
    return;
  }
  if (mDrawable.getLevel() != 0 && !isSetAnim) {
    beginAnimation();
    isSetAnim = true;
  }
  setbubble(mBubbleList, canvas);
}

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

/**
 * Creates a new instance of DrawableWrapper which wraps the given <var>drawable</var>.
 *
 * @param drawable The drawable to wrap.
 */
public DrawableWrapper(@NonNull Drawable drawable) {
  this.mDrawable = drawable;
  /**
   * Copy current state of the wrapped drawable.
   */
  setState(drawable.getState());
  setBounds(drawable.getBounds());
  setLevel(drawable.getLevel());
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    setCallback(drawable.getCallback());
  } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    setAlpha(drawable.getAlpha());
  } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    setColorFilter(drawable.getColorFilter());
  }
  mDrawable.setCallback(this);
}

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

/**
 * Creates a new instance of DrawableWrapper which wraps the given <var>drawable</var>.
 *
 * @param drawable The drawable to wrap.
 */
public DrawableWrapper(@NonNull Drawable drawable) {
  this.mDrawable = drawable;
  /**
   * Copy current state of the wrapped drawable.
   */
  setState(drawable.getState());
  setBounds(drawable.getBounds());
  setLevel(drawable.getLevel());
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    setCallback(drawable.getCallback());
  } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    setAlpha(drawable.getAlpha());
  } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    setColorFilter(drawable.getColorFilter());
  }
  mDrawable.setCallback(this);
}

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

/**
 * Creates a new instance of DrawableWrapper which wraps the given <var>drawable</var>.
 *
 * @param drawable The drawable to wrap.
 */
public DrawableWrapper(@NonNull Drawable drawable) {
  this.mDrawable = drawable;
  /**
   * Copy current state of the wrapped drawable.
   */
  setState(drawable.getState());
  setBounds(drawable.getBounds());
  setLevel(drawable.getLevel());
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    setCallback(drawable.getCallback());
  } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    setAlpha(drawable.getAlpha());
  } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    setColorFilter(drawable.getColorFilter());
  }
  mDrawable.setCallback(this);
}

代码示例来源:origin: AlexMofer/ProjectX

public final void setWrappedDrawable(Drawable dr) {
  if (this.mDrawable != null) {
    this.mDrawable.setCallback((Callback) null);
  }
  this.mDrawable = dr;
  if (dr != null) {
    dr.setCallback(this);
    this.setVisible(dr.isVisible(), true);
    this.setState(dr.getState());
    this.setLevel(dr.getLevel());
    this.setBounds(dr.getBounds());
    if (this.mState != null) {
      this.mState.mDrawableState = dr.getConstantState();
    }
  }
  this.invalidateSelf();
}

代码示例来源:origin: derry/delion

private void setupImageButton(TintedImageButton button, final MenuItem item) {
  // Store and recover the level of image as button.setimageDrawable
  // resets drawable to default level.
  int currentLevel = item.getIcon().getLevel();
  button.setImageDrawable(item.getIcon());
  item.getIcon().setLevel(currentLevel);
  if (item.isChecked()) {
    button.setTint(ApiCompatibilityUtils.getColorStateList(
        button.getResources(), R.color.blue_mode_tint));
  }
  button.setEnabled(item.isEnabled());
  button.setFocusable(item.isEnabled());
  button.setContentDescription(item.getTitleCondensed());
  button.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
      mAppMenu.onItemClick(item);
    }
  });
}

相关文章