android.widget.ImageView.setLayerType()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(331)

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

ImageView.setLayerType介绍

暂无

代码示例

代码示例来源:origin: qiujuer/Genius-Android

@Override
public void setLayerType(int layerType, Paint paint) {
  // In this, to support Canvas.clipPath(),
  // must set layerType is View.LAYER_TYPE_SOFTWARE
  layerType = View.LAYER_TYPE_SOFTWARE;
  super.setLayerType(layerType, paint);
}

代码示例来源:origin: qiujuer/Genius-Android

@Override
public void setLayerType(int layerType, Paint paint) {
  // In this, to support Canvas.clipPath(),
  // must set layerType is View.LAYER_TYPE_SOFTWARE
  // on your need touch draw
  if (mTouchDrawable != null)
    layerType = View.LAYER_TYPE_SOFTWARE;
  super.setLayerType(layerType, paint);
}

代码示例来源:origin: bumptech/glide

@Override
 public boolean onResourceReady(PictureDrawable resource, Object model,
   Target<PictureDrawable> target, DataSource dataSource, boolean isFirstResource) {
  ImageView view = ((ImageViewTarget<?>) target).getView();
  view.setLayerType(ImageView.LAYER_TYPE_SOFTWARE, null);
  return false;
 }
}

代码示例来源:origin: bumptech/glide

@Override
public boolean onLoadFailed(GlideException e, Object model, Target<PictureDrawable> target,
  boolean isFirstResource) {
 ImageView view = ((ImageViewTarget<?>) target).getView();
 view.setLayerType(ImageView.LAYER_TYPE_NONE, null);
 return false;
}

代码示例来源:origin: fossasia/pslab-android

public void setup(final ApplicationItem applicationItem, final OnItemClickListener listener) {
    header.setText(applicationItem.getApplicationName());
    description.setText(applicationItem.getApplicationDescription());
    applicationIcon.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    applicationIcon.setImageResource(applicationItem.getApplicationIcon());
    itemView.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
        listener.onItemClick(applicationItem);
      }
    });
  }
}

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

ImageView imageView = (ImageView) findViewById(R.id.imgView);
SVGParser svg = SVGParser.getSVGFromResource(getResources(), R.drawable.example);
//The following is needed because of image accelaration in some devices such as samsung
imageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
imageView.setImageDrawable(svg.createPictureDrawable());

代码示例来源:origin: goodbranch/ScreenCapture

@Override
 public void onAnimationEnd(Animator animation) {
  mBackgroundView.setVisibility(View.GONE);
  mScreenshotView.setVisibility(View.GONE);
  mScreenshotView.setLayerType(View.LAYER_TYPE_NONE, null);
 }
});

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

import android.app.Activity;
import android.view.View;
import android.widget.ImageView;

import com.larvalabs.svgandroid.SVG;
import com.larvalabs.svgandroid.SVGParser;

public class SvgImage {

  private static ImageView imageView;
  private Activity activity;
  private SVG svg;
  private int xmlLayoutId;
  private int drawableId;

  public SvgImage(Activity activity, int layoutId, int drawableId) {
    imageView = (ImageView) activity.findViewById(layoutId);
    svg = SVGParser.getSVGFromResource(activity.getResources(), drawableId);
    //Needed because of image accelaration in some devices such as samsung
    imageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    imageView.setImageDrawable(svg.createPictureDrawable());
  }
}

代码示例来源:origin: davideas/FlipView

/**
 * {@link #LAYER_TYPE_SOFTWARE} is automatically set for you, only on the ImageView reference.
 *
 * @param drawable The SVG Drawable
 */
@Override
public void setPictureDrawable(PictureDrawable drawable) {
  pictureDrawable = drawable;
  if (this.frontImage == null) {
    Log.w(TAG, "ImageView not found in the first child of the FrontLayout. Image cannot be set!");
    return;
  }
  frontImage.setLayerType(LAYER_TYPE_SOFTWARE, null);
  frontImage.setImageDrawable(pictureDrawable);
}

代码示例来源:origin: sromku/memory-game

private void startLightsAnimation() {
  ObjectAnimator animator = ObjectAnimator.ofFloat(mStartButtonLights, "rotation", 0f, 360f);
  animator.setInterpolator(new AccelerateDecelerateInterpolator());
  animator.setDuration(6000);
  animator.setRepeatCount(ValueAnimator.INFINITE);
  mStartButtonLights.setLayerType(View.LAYER_TYPE_HARDWARE, null);
  animator.start();
}

代码示例来源:origin: goodbranch/ScreenCapture

@Override
 public void run() {
  // Play the shutter sound to notify that we've taken a screenshot
  mCameraSound.play(MediaActionSound.SHUTTER_CLICK);
  mScreenshotView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
  mScreenshotView.buildLayer();
  mScreenshotAnimation.start();
 }
});

代码示例来源:origin: sromku/memory-game

private void startTootipAnimation() {
  ObjectAnimator scaleY = ObjectAnimator.ofFloat(mTooltip, "scaleY", 0.8f);
  scaleY.setDuration(200);
  ObjectAnimator scaleYBack = ObjectAnimator.ofFloat(mTooltip, "scaleY", 1f);
  scaleYBack.setDuration(500);
  scaleYBack.setInterpolator(new BounceInterpolator());
  final AnimatorSet animatorSet = new AnimatorSet();
  animatorSet.setStartDelay(1000);
  animatorSet.playSequentially(scaleY, scaleYBack);
  animatorSet.addListener(new AnimatorListenerAdapter() {
    @Override
    public void onAnimationEnd(Animator animation) {
      animatorSet.setStartDelay(2000);
      animatorSet.start();
    }
  });
  mTooltip.setLayerType(View.LAYER_TYPE_HARDWARE, null);
  animatorSet.start();
}

代码示例来源:origin: daliyan/MyKeep

/**
 * 设置Image图片
 * @param context
 * @param viewId
 * @param svgId
 */
public static void setImageDrawable(Context context,int viewId,int svgId){
  SVG svg = new SVGBuilder().readFromResource(context.getResources(), svgId).build();
  ImageView imageView = (ImageView) ((Activity)context).findViewById(viewId);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    imageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
  }
  imageView.setImageDrawable(svg.getDrawable());
}

代码示例来源:origin: daliyan/MyKeep

/**
 * 获取Image图片
 * @param svgId
 * @return
 */
public static void setImageDrawable(ImageView imageView,int svgId){
  SVG svg = new SVGBuilder().readFromResource(AppContext.getInstance().getResources(), svgId).build();
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    imageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
  }
  imageView.setImageDrawable(svg.getDrawable());
}

代码示例来源:origin: fafaldo/FABToolbar

fab.setLayerType(LAYER_TYPE_SOFTWARE, null);

代码示例来源:origin: mime-mob/AndroidAdvanceAnimation

public void startPathView(View view) {
  pathView.getPathAnimator().
      delay(100).
      duration(1500).
      interpolator(new AccelerateDecelerateInterpolator()).
      start();
  try {
    SVG svg = SVG.getFromResource(this, R.raw.android);
    Picture picture = svg.renderToPicture();
    Drawable drawable = new PictureDrawable(picture);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
      ivDemo.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
    ivDemo.setImageDrawable(drawable);
  } catch (SVGParseException e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: KishanV/Android-Music-Player

img.setX( (((layout.width - imgWh) / 2)));
if(android.os.Build.VERSION.SDK_INT <= 18){
  img.setLayerType(View.LAYER_TYPE_HARDWARE, null);

相关文章

ImageView类方法