naseemakhtar994 / ShapedImageView

Android Rounded, Circle, Path ImageView

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ShapedImageView

  • 支持圆形 圆角矩形
  • 支持显示边框
  • 支持TransitionDrawable
  • New 支持自定义Path扩展

Screenshots

Usage

dependencies

compile 'cn.gavinliu.android.lib:ShapedImageView:0.8.1'

Circle

<cn.gavinliu.android.lib.shapedimageview.ShapedImageView
    ...
    app:shape_mode="circle"

    app:stroke_color="#009688"
    app:stroke_width="3dp" />

Round Rect

<cn.gavinliu.android.lib.shapedimageview.ShapedImageView
    ...
    app:shape_mode="round_rect"
    app:round_radius="20dp"

    app:stroke_color="#009688"
    app:stroke_width="3dp" />

PathExtension

image1.setExtension(new CDPathExtension());

class CDPathExtension implements ShapedImageView.PathExtension {

    @Override
    public void onLayout(Path path, int width, int height) {
        path.reset();
        path.addCircle(width / 2, height / 2, width / 8, Path.Direction.CW);
    }
}

TODO

  • Support Any Shape (SVG to PathShape)

License

MIT

About

Android Rounded, Circle, Path ImageView


Languages

Language:Java 100.0%