本文整理匯總了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);
}
}
}
示例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;
}
示例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;
}
示例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);
}