porosty / RoundImageView

圆形图片和可控位置圆角图片

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RoundImageView

圆形图片和可控位置圆角图片

圆形图片

  • borderWidth 边框宽度
  • borderColor 边框颜色

圆角图片

  • borderWidth 边框宽度
  • borderColor 边框颜色
  • leftTopRadius 左上角圆角半径
  • rightTopRadius 右上角圆角半径
  • rightBottomRadius 右下角圆角半径
  • leftBottomRadius 左下角圆角半径

使用

gradle

Step 1. 添加JitPack到根配置文件

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

Step 2. 添加依赖

dependencies {
	        compile 'com.github.LineChen:RoundImageView:v1.0.0'
	}

maven

Step 1. 添加JitPack到配置文件

<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Step 2. 添加依赖

<dependency>
	    <groupId>com.github.LineChen</groupId>
	    <artifactId>RoundImageView</artifactId>
	    <version>v1.0.0</version>
	</dependency>
布局
<com.beiing.roundimage.CircleImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:scaleType="centerCrop"
        android:src="@mipmap/head"
        app:borderWidth="2dp"
        app:borderColor="#8c9eff"
        />
 <com.beiing.roundimage.RoundImageView
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:scaleType="centerCrop"
                android:src="@mipmap/test"
                app:borderWidth="2dp"
                app:borderColor="#8c9eff"
                app:leftTopRadius="10dp"
                app:rightTopRadius="30dp"
                app:rightBottomRadius="10dp"
                app:leftBottomRadius="30dp"
                />
测试常见的图片加载库加载
  • Glide
 circleImageViewGlide = (CircleImageView) findViewById(R.id.circle_image_glide);
 Glide.with(this).load("http://img2.imgtn.bdimg.com/it/u=1939271907,257307689&fm=21&gp=0.jpg").into(circleImageViewGlide);
  • Picasso
roundImageViewPicasso = (RoundImageView) findViewById(R.id.round_image_picasso);
 Picasso.with(this).load("http://img0.imgtn.bdimg.com/it/u=2263418180,3668836868&fm=206&gp=0.jpg").fit().into(roundImageViewPicasso);
  • xUtils3
roundImageViewXutils = (RoundImageView) findViewById(R.id.round_image_xutils);
x.image().bind(roundImageViewXutils, "http://img0.imgtn.bdimg.com/it/u=2263418180,3668836868&fm=206&gp=0.jpg",
                new ImageOptions.Builder().setCrop(true).build());

效果图

screenshot

About

圆形图片和可控位置圆角图片


Languages

Language:Java 100.0%