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

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

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

Drawable.setAutoMirrored介绍

暂无

代码示例

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

@Override
@TargetApi(Build.VERSION_CODES.KITKAT)
public void setAutoMirrored(boolean mirrored) {
  mLayerState.mAutoMirrored = mirrored;
  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.setAutoMirrored(mirrored);
    }
  }
}

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

/**
 * Add a new layer to this drawable. The new layer is identified by an id.
 *
 * @param dr         The drawable to add as a layer.
 * @param themeAttrs Theme attributes extracted from the layer.
 * @param id         The id of the new layer.
 * @param left       The left padding of the new layer.
 * @param top        The top padding of the new layer.
 * @param right      The right padding of the new layer.
 * @param bottom     The bottom padding of the new layer.
 */
ChildDrawable addLayer(Drawable dr, int[] themeAttrs, int id,
            int left, int top, int right, int bottom) {
  final ChildDrawable childDrawable = createLayer(dr);
  childDrawable.mId = id;
  childDrawable.mThemeAttrs = themeAttrs;
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
    childDrawable.mDrawable.setAutoMirrored(isAutoMirrored());
  childDrawable.mInsetL = left;
  childDrawable.mInsetT = top;
  childDrawable.mInsetR = right;
  childDrawable.mInsetB = bottom;
  addLayer(childDrawable);
  mLayerState.mChildrenChangingConfigurations |= dr.getChangingConfigurations();
  dr.setCallback(this);
  return childDrawable;
}

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

d.setAutoMirrored(mDrawableContainerState.mAutoMirrored);

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

public void setAutoMirrored(boolean mirrored) {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    this.mDrawable.setAutoMirrored(mirrored);
  }
}

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

@Override
public void setAutoMirrored(boolean mirrored) {
  if (mDrawable == null)
    return;
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
    mDrawable.setAutoMirrored(mirrored);
}

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

@Override
public void setAutoMirrored(boolean mirrored) {
  if (mDrawable == null)
    return;
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
    mDrawable.setAutoMirrored(mirrored);
}

代码示例来源:origin: kingargyle/adt-leanback-support

public static void setAutoMirrored(Drawable drawable, boolean mirrored) {
  drawable.setAutoMirrored(mirrored);
}

代码示例来源:origin: MCMrARM/revolution-irc

@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public void setAutoMirrored(boolean mirrored) {
  mDrawable.setAutoMirrored(mirrored);
}

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

@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public void setAutoMirrored(boolean mirrored) {
  if (mItems.isEmpty()) {
    super.setAutoMirrored(mirrored);
    return;
  }
  for (ChildDrawable child : mItems) {
    child.getDrawable().setAutoMirrored(mirrored);
  }
}

代码示例来源:origin: mingjunli/GithubApp

public void addCrumb(@NonNull Crumb crumb, boolean refreshLayout) {
  LinearLayout view = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.bread_crumb, this, false);
  view.setTag(mCrumbs.size());
  view.setOnClickListener(this);
  ImageView iv = (ImageView) view.getChildAt(1);
  Drawable arrow = getResources().getDrawable(R.drawable.ic_right_arrow);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    if (arrow != null) {
      arrow.setAutoMirrored(true);
    }
  }
  iv.setImageDrawable(arrow);
  iv.setVisibility(View.GONE);
  mChildFrame.addView(view, new ViewGroup.LayoutParams(
      ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
  mCrumbs.add(crumb);
  if (refreshLayout) {
    mActive = mCrumbs.size() - 1;
    requestLayout();
  }
  invalidateActivatedAll();
}

代码示例来源:origin: Leaking/WeGit

public void addCrumb(@NonNull Crumb crumb, boolean refreshLayout) {
  LinearLayout view = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.bread_crumb, this, false);
  view.setTag(mCrumbs.size());
  view.setOnClickListener(this);
  ImageView iv = (ImageView) view.getChildAt(1);
  Drawable arrow = getResources().getDrawable(R.drawable.ic_right_arrow);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    if (arrow != null) {
      arrow.setAutoMirrored(true);
    }
  }
  iv.setImageDrawable(arrow);
  iv.setVisibility(View.GONE);
  mChildFrame.addView(view, new ViewGroup.LayoutParams(
      ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
  mCrumbs.add(crumb);
  if (refreshLayout) {
    mActive = mCrumbs.size() - 1;
    requestLayout();
  }
  invalidateActivatedAll();
}

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

@SuppressLint("RtlHardcoded")
private Drawable getIllustration(Drawable asset, Drawable horizontalTile) {
  final Context context = getContext();
  if (context.getResources().getBoolean(R.bool.suwUseTabletLayout)) {
    // If it is a "tablet" (sw600dp), create a LayerDrawable with the horizontal tile.
    if (horizontalTile instanceof BitmapDrawable) {
      ((BitmapDrawable) horizontalTile).setTileModeX(TileMode.REPEAT);
      ((BitmapDrawable) horizontalTile).setGravity(Gravity.TOP);
    }
    if (asset instanceof BitmapDrawable) {
      // Always specify TOP | LEFT, Illustration will flip the entire LayerDrawable.
      ((BitmapDrawable) asset).setGravity(Gravity.TOP | Gravity.LEFT);
    }
    final LayerDrawable layers =
        new LayerDrawable(new Drawable[] { horizontalTile, asset });
    if (VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
      layers.setAutoMirrored(true);
    }
    return layers;
  } else {
    // If it is a "phone" (not sw600dp), simply return the illustration
    if (VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
      asset.setAutoMirrored(true);
    }
    return asset;
  }
}

相关文章