Giter Site home page Giter Site logo

ylcircleimageview's Introduction

YLCircleImageView

如果依赖失败,可以直接下载Library中的YLCircleImageView 和 style.xml放入项目中

QQ:375984181

https://juejin.im/post/5c4826446fb9a049ef26ecb4

功能

  • 具备描边功能
  • 具备图片和描边间距功能
  • 具备图片四个角,每个角均可单独设置 X Y 轴方向的半径

代码

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

现在最新版本是 v1.0.6,以后可能会更新,所以大家需要看一下 release版本

    implementation 'com.github.ai2101039:YLCircleImageView:v1.0.6'
    <com.android.library.YLCircleImageView
        android:layout_width="100dp"
        android:layout_height="100dp"
        app:radius="50dp"/>

在v1.0.6中增加XML设置

增加了对Circle属性变量的设置,原本想做成 build模式,后来想了想没有必要。

大家记得如果你要绘制圆角,一定要 circle 设置为 true。

                //  设置图片格式
                ylCircleImageView.setStyleType(YLCircleImageView.TOP);
                //  设置圆角,这里可设置八个角度大小
                ylCircleImageView.setRadius(20F);
                //  设置描边宽度
                ylCircleImageView.setBorderWidth(10F);
                //  设置描边颜色
                ylCircleImageView.setBorderColor(Color.WHITE);
                //  设置描边与图片的间距
                ylCircleImageView.setBorderSpace(5F);
                //  重要:设置circle为真,切记一定要带着这一条
                ylCircleImageView.setCircle(true);
                //  重绘
                ylCircleImageView.invalidate();
                

效果图

GIF

GIF

其他

这种写法表示,左上半径10,其他半径50
        <com.android.library.YLCircleImageView
            android:layout_width="100dp"
            android:layout_height="100dp"
            app:radius="50dp"
            app:topLeftRadius="10dp"/>
这种写法表示,左上X轴20,左上Y轴10,其他半径50
        <com.android.library.YLCircleImageView
            android:layout_width="100dp"
            android:layout_height="100dp"
            app:radius="50dp"
            app:topLeftRadius="10dp"
            app:topLeftRadius_x="20dp"/>

属性图

ylcircleimageview's People

Contributors

ai2101039 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.