CircularImageView

CircularImageView

项目地址:lopspower/CircularImageView 

简介:Create circular ImageView in Android in the simplest way possible.

更多:作者   提 Bug   

标签:

 

sample

License Platform 
Twitter

This is an Android project allowing to realize a circular ImageView in the simplest way possible.

Android app on Google Play

USAGE

To make a circular ImageView add CircularImageView in your layout XML and add CircularImageView library in your project or you can also grab it via Gradle:

implementation 'com.mikhaellopez:circularimageview:3.2.0'

XML

<com.mikhaellopez.circularimageview.CircularImageView
        android:layout_width="250dp"
        android:layout_height="250dp"
        android:src="@drawable/image"
        app:civ_border_color="#EEEEEE"
        app:civ_border_width="4dp"
        app:civ_shadow="true"
        app:civ_shadow_radius="10"
        app:civ_shadow_color="#8BC34A"/>

You must use the following properties in your XML to change your CircularImageView.

Properties:

  • app:civ_border (boolean) -> default true
  • app:civ_border_color (color) -> default WHITE
  • app:civ_border_width (dimension) -> default 4dp
  • app:civ_background_color (color) -> default WHITE
  • app:civ_shadow (boolean) -> default false
  • app:civ_shadow_color (color) -> default BLACK
  • app:civ_shadow_radius (float) -> default 8.0f
  • app:civ_shadow_gravity (center, top, bottom, start or end) -> default bottom

JAVA

CircularImageView circularImageView = (CircularImageView)findViewById(R.id.yourCircularImageView);
// Set Border
circularImageView.setBorderColor(getResources().getColor(R.color.GrayLight));
circularImageView.setBorderWidth(10);
// Add Shadow with default param
circularImageView.addShadow();
// or with custom param
circularImageView.setShadowRadius(15);
circularImageView.setShadowColor(Color.RED);
circularImageView.setBackgroundColor(Color.RED);
circularImageView.setShadowGravity(CircularImageView.ShadowGravity.CENTER);

LIMITATIONS

  • By default the ScaleType is CENTER_CROP. You can also used CENTER_INSIDE but the others one are not supported.
  • Enabling adjustViewBounds is not supported as this requires an unsupported ScaleType.

Stack OverFlow:

I realized this project using this post:

LICENCE

CircularImageView by Lopez Mikhael is licensed under a Apache License 2.0.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值