本文整理汇总了Java中com.makeramen.roundedimageview.RoundedDrawable类的典型用法代码示例。如果您正苦于以下问题:Java RoundedDrawable类的具体用法?Java RoundedDrawable怎么用?Java RoundedDrawable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RoundedDrawable类属于com.makeramen.roundedimageview包,在下文中一共展示了RoundedDrawable类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: asDrawable
import com.makeramen.roundedimageview.RoundedDrawable; //导入依赖的package包/类
@Override
public Drawable asDrawable(Context context, int color, boolean inverted) {
Drawable background = TextDrawable.builder().buildRound(" ", inverted ? Color.WHITE : color);
RoundedDrawable foreground = (RoundedDrawable) RoundedDrawable.fromDrawable(context.getResources().getDrawable(resourceId));
foreground.setScaleType(ImageView.ScaleType.CENTER);
if (inverted) {
foreground.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
}
return new ExpandingLayerDrawable(new Drawable[] {background, foreground});
}
示例2: asDrawable
import com.makeramen.roundedimageview.RoundedDrawable; //导入依赖的package包/类
@Override
public Drawable asDrawable(Context context, int color, boolean inverted) {
return RoundedDrawable.fromBitmap(bitmap)
.setScaleType(ImageView.ScaleType.CENTER_CROP)
.setOval(true);
}
示例3: asDrawable
import com.makeramen.roundedimageview.RoundedDrawable; //导入依赖的package包/类
@Override
public Drawable asDrawable(Context context, int color, boolean inverted) {
return RoundedDrawable.fromDrawable(context.getResources().getDrawable(android.R.color.transparent));
}