资源简介
android圆形图片控件,在项目开发中,我们经常需要用到圆形图片效果,典型案例是用户头像的显示。
代码片段和文件信息
/*
* Copyright 2014 - 2019 Henning Dodenhof
*
* Licensed under the Apache License Version 2.0 (the “License“);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing software
* distributed under the License is distributed on an “AS IS“ BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.hdodenhof.circleimageview;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Matrix;
import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewOutlineProvider;
import android.widget.ImageView;
import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.DrawableRes;
import androidx.annotation.RequiresApi;
@SuppressWarnings(“UnusedDeclaration“)
public class CircleImageView extends ImageView {
private static final ScaleType SCALE_TYPE = ScaleType.CENTER_CROP;
private static final Bitmap.Config BITMAP_CONFIG = Bitmap.Config.ARGB_8888;
private static final int COLORDRAWABLE_DIMENSION = 2;
private static final int DEFAULT_BORDER_WIDTH = 0;
private static final int DEFAULT_BORDER_COLOR = Color.BLACK;
private static final int DEFAULT_CIRCLE_BACKGROUND_COLOR = Color.TRANSPARENT;
private static final boolean DEFAULT_BORDER_OVERLAY = false;
private final RectF mDrawableRect = new RectF();
private final RectF mBorderRect = new RectF();
private final Matrix mShaderMatrix = new Matrix();
private final Paint mBitmapPaint = new Paint();
private final Paint mBorderPaint = new Paint();
private final Paint mCircleBackgroundPaint = new Paint();
private int mBorderColor = DEFAULT_BORDER_COLOR;
private int mBorderWidth = DEFAULT_BORDER_WIDTH;
private int mCircleBackgroundColor = DEFAULT_CIRCLE_BACKGROUND_COLOR;
private Bitmap mBitmap;
private BitmapShader mBitmapShader;
private int mBitmapWidth;
private int mBitmapHeight;
private float mDrawableRadius;
private float mBorderRadius;
private ColorFilter mColorFilter;
private boolean mReady;
private boolean mSetupPendi
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-01-06 11:52 CircleImageView-master\
文件 134 2019-01-06 11:52 CircleImageView-master\.gitignore
文件 11359 2019-01-06 11:52 CircleImageView-master\LICENSE.txt
文件 5261 2019-01-06 11:52 CircleImageView-master\README.md
文件 281 2019-01-06 11:52 CircleImageView-master\build.gradle
目录 0 2019-01-06 11:52 CircleImageView-master\circleimageview\
文件 350 2019-01-06 11:52 CircleImageView-master\circleimageview\build.gradle
文件 74 2019-01-06 11:52 CircleImageView-master\circleimageview\gradle.properties
目录 0 2019-01-06 11:52 CircleImageView-master\circleimageview\src\
目录 0 2019-01-06 11:52 CircleImageView-master\circleimageview\src\main\
文件 185 2019-01-06 11:52 CircleImageView-master\circleimageview\src\main\AndroidManifest.xm
目录 0 2019-01-06 11:52 CircleImageView-master\circleimageview\src\main\java\
目录 0 2019-01-06 11:52 CircleImageView-master\circleimageview\src\main\java\de\
目录 0 2019-01-06 11:52 CircleImageView-master\circleimageview\src\main\java\de\hdodenhof\
目录 0 2019-01-06 11:52 CircleImageView-master\circleimageview\src\main\java\de\hdodenhof\circleimageview\
文件 13477 2019-01-06 11:52 CircleImageView-master\circleimageview\src\main\java\de\hdodenhof\circleimageview\CircleImageView.java
目录 0 2019-01-06 11:52 CircleImageView-master\circleimageview\src\main\res\
目录 0 2019-01-06 11:52 CircleImageView-master\circleimageview\src\main\res\values\
文件 379 2019-01-06 11:52 CircleImageView-master\circleimageview\src\main\res\values\attrs.xm
文件 613 2019-01-06 11:52 CircleImageView-master\gradle.properties
目录 0 2019-01-06 11:52 CircleImageView-master\gradle\
目录 0 2019-01-06 11:52 CircleImageView-master\gradle\wrapper\
文件 50508 2019-01-06 11:52 CircleImageView-master\gradle\wrapper\gradle-wrapper.jar
文件 231 2019-01-06 11:52 CircleImageView-master\gradle\wrapper\gradle-wrapper.properties
文件 5080 2019-01-06 11:52 CircleImageView-master\gradlew
文件 2404 2019-01-06 11:52 CircleImageView-master\gradlew.bat
目录 0 2019-01-06 11:52 CircleImageView-master\sample\
文件 253 2019-01-06 11:52 CircleImageView-master\sample\build.gradle
文件 670 2019-01-06 11:52 CircleImageView-master\sample\proguard-rules.txt
目录 0 2019-01-06 11:52 CircleImageView-master\sample\src\
目录 0 2019-01-06 11:52 CircleImageView-master\sample\src\main\
............此处省略27个文件信息
- 上一篇:Java聊天室程序,socket编程
- 下一篇:在线财务管理系统(含源码)
相关资源
- 用android编写的电话拨号器
- android 日程表项目源代码
- opencv 安卓开发jar包,2.4.9最高版本
- Android中Webview与原生界面交互及二维码
- android利用Socket实现手机客户端与PC进
- android的wifi开关按钮和移动网络开关按
- Android意见反馈功能的代码框架
- Android九宫格手势密码解锁控件源码及
- Android客户端与服务器端的json数据交互
- Android DatePicker Demo
- android实用的通讯录项目 已连接数据库
- android 4.4 原生闹钟源码
- unity集成android原生录音可后台并实现
- Android猜牌游戏源码
- Android 极速获取局域网在线设备信息
- android获取手机通讯录所有字段
- 2_BATAndroid面试2018最新
- 高通平台android-modem 架构总结
- Android ListView控件显示数据库中图片
- android2.2 制作相册
- android SQLite (代码建库表布局)导入
- Android版本升级
- AndroidWiFi热点Demo
- Android蓝牙Demo
- android 计算器源代码 含算法
- Android Bluetooth文件传输
- Android文件管理器源码
- Android的APp作为Socket服务端与pc通过U
- Android Demo实现书架效果
- android获取手机加速度源码
评论
共有 条评论