EventViewBuilder.java 文件源码

java
阅读 22 收藏 0 点赞 0 评论 0

项目:EventLock 作者:
void setupColorImageView(int[] padding, String type, int[] manualDimensions, boolean[] isManualDimensions, int[] autoDimensions) {
    colorImageView = new ImageView(gismoContext);
    fullContainerRelativeLayout.addView(colorImageView);
    colorImageView.setTag(Enums.ItemTag.Image);
    GradientDrawable outlineDrawable = new GradientDrawable();
    ShapeDrawable shapeDrawable = new ShapeDrawable();
    if (type.equals("oval")) {
        shapeDrawable.setShape(new OvalShape());
        outlineDrawable.setShape(GradientDrawable.OVAL);
    } else {
        shapeDrawable.setShape(new RectShape());
        outlineDrawable.setShape(GradientDrawable.RECTANGLE);
    }
    shapeDrawable.setIntrinsicWidth(isManualDimensions[0] ? manualDimensions[0] : autoDimensions[0]);
    shapeDrawable.setIntrinsicHeight(isManualDimensions[1] ? manualDimensions[1] : autoDimensions[1]);
    colorImageView.setImageDrawable(new LayerDrawable(new Drawable[]{shapeDrawable, outlineDrawable}));
    colorImageView.getLayoutParams().height = RelativeLayout.LayoutParams.WRAP_CONTENT;
    colorImageView.getLayoutParams().width = RelativeLayout.LayoutParams.WRAP_CONTENT;
    colorImageView.setPadding(padding[0], padding[1], padding[2], padding[3]);
    colorImageView.setAdjustViewBounds(true);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号