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

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

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

Drawable.setLayoutDirection介绍

暂无

代码示例

代码示例来源:origin: google/ExoPlayer

private static boolean setDrawableLayoutDirection(Drawable drawable, int layoutDirection) {
 return Util.SDK_INT >= 23 && drawable.setLayoutDirection(layoutDirection);
}

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

final boolean setLayoutDirection(int layoutDirection, int currentIndex) {
  boolean changed = false;
  // No need to call createAllFutures, since future drawables will
  // change layout direction when they are prepared.
  final int count = mNumChildren;
  final Drawable[] drawables = mDrawables;
  for (int i = 0; i < count; i++) {
    if (drawables[i] != null) {
      boolean childChanged = false;
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        childChanged = drawables[i].setLayoutDirection(layoutDirection);
      }
      if (i == currentIndex) {
        changed = childChanged;
      }
    }
  }
  mLayoutDirection = layoutDirection;
  return changed;
}

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

private Drawable prepareDrawable(Drawable child) {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    child.setLayoutDirection(mLayoutDirection);
  }
  child = child.mutate();
  child.setCallback(mOwner);
  return child;
}

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

/**
 * @hide / public void clearMutated() { super.clearMutated();
 * <p/>
 * 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.clearMutated(); } } mMutated = false; }
 */
@Override
public boolean onLayoutDirectionChanged(int layoutDirection) {
  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) {
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
        changed |= dr.setLayoutDirection(layoutDirection);
    }
  }
  updateLayerBounds(getBounds());
  return changed;
}

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

clone.setLayoutDirection(dr.getLayoutDirection());
clone.setBounds(dr.getBounds());
clone.setLevel(dr.getLevel());

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

d.setCallback(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
  d.setLayoutDirection(getLayoutDirection());

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

d.setCallback(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
  d.setLayoutDirection(getLayoutDirection());

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

d.setBounds(getBounds());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
  d.setLayoutDirection(getLayoutDirection());

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

private synchronized void doRefreshProgress(int id, int progress, boolean fromUser,
    boolean callBackToApp) {
  float scale = mMax > 0 ? (float) progress / (float) mMax : 0;
  final Drawable d = mCurrentDrawable;
  if (d != null) {
    Drawable progressDrawable = null;

    if (d instanceof LayerDrawable) {
      progressDrawable = ((LayerDrawable) d).findDrawableByLayerId(id);
      if (progressDrawable != null && canResolveLayoutDirection()) {
        progressDrawable.setLayoutDirection(getLayoutDirection());
      }
    }

    final int level = (int) (scale * MAX_LEVEL);
    (progressDrawable != null ? progressDrawable : d).setLevel(level);
  } else {
>>>     invalidate();
  }

  if (callBackToApp && id == R.id.progress) {
    onProgressRefresh(scale, fromUser);
  }
}

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

@TargetApi(Build.VERSION_CODES.M)
@Override
public boolean onLayoutDirectionChanged(int layoutDirection) {
  if (mItems.isEmpty())
    return super.onLayoutDirectionChanged(layoutDirection);
  boolean changed = false;
  for (ChildDrawable child : mItems) {
    changed |= child.getDrawable().setLayoutDirection(layoutDirection);
  }
  refreshChildBounds();
  return changed;
}

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

background.setLayoutDirection(getLayoutDirection());
if (background.getPadding(padding)) {
  resetResolvedPadding();

代码示例来源:origin: YiiGuxing/CompositionAvatar

drawable.setLayoutDirection(getLayoutDirection());

相关文章