当前位置: 首页>>代码示例>>Java>>正文


Java ImageView.setLayerType方法代码示例

本文整理汇总了Java中android.widget.ImageView.setLayerType方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.setLayerType方法的具体用法?Java ImageView.setLayerType怎么用?Java ImageView.setLayerType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.ImageView的用法示例。


在下文中一共展示了ImageView.setLayerType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setSuccessDrawable4Callback

import android.widget.ImageView; //导入方法依赖的package包/类
private void setSuccessDrawable4Callback(final Drawable drawable) {
    final ImageView view = viewRef.get();
    if (view != null) {
        view.setScaleType(options.getImageScaleType());
        if (drawable instanceof GifDrawable) {
            if (view.getScaleType() == ImageView.ScaleType.CENTER) {
                view.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
            }
            view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        }
        if (options.getAnimation() != null) {
            ImageAnimationHelper.animationDisplay(view, drawable, options.getAnimation());
        } else if (options.isFadeIn()) {
            ImageAnimationHelper.fadeInDisplay(view, drawable);
        } else {
            view.setImageDrawable(drawable);
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:ImageLoader.java

示例2: onLoadFailed

import android.widget.ImageView; //导入方法依赖的package包/类
@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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:SvgSoftwareLayerSetter.java

示例3: onResourceReady

import android.widget.ImageView; //导入方法依赖的package包/类
@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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:SvgSoftwareLayerSetter.java

示例4: addImage

import android.widget.ImageView; //导入方法依赖的package包/类
/**
 * Adds the appropriate symbol to the center of the card. This takes the
 * class attributes and displays the image with the correct shape, color, and fill
 * and can be called multiple times to display the correct count of symbols.
 *
 * @param context Context of our view
 */
private void addImage(Context context, LinearLayout linearLayout) {

    ImageView symbolView = new ImageView(context);

    /*
     * Turn off hardware acceleration for this View otherwise
     * the colors don't get drawn correctly
     */
    symbolView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);


    // Set the height of the image to 1/2 the card height
    int imageHeight = (int) Math.floor(getHeight() * 0.7);
    int imageWidth = imageHeight / 2;
    LayoutParams params = new LayoutParams(
            imageWidth,
            imageHeight
    );
    params.setMarginEnd(10);
    params.setMarginStart(10);
    symbolView.setLayoutParams(params);

    // Get drawable resource from ShapeFill array
    Drawable symbol = context.getDrawable(mShapeFill[mShape][mFill]);

    // Set symbol color based on defaults or user preferences
    setSymbolColor(symbol);

    // Set the drawable to the imageview
    symbolView.setImageDrawable(symbol);

    // Add the completed imageview to the layout
    linearLayout.addView(symbolView, 0);
}
 
开发者ID:jaysondc,项目名称:TripleTap,代码行数:42,代码来源:SetGameCardView.java


注:本文中的android.widget.ImageView.setLayerType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。