Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/abdularis/circularimageview

Circle image view :red_circle: and Avatar image view :smiley: for android
https://github.com/abdularis/circularimageview

android android-imageview android-library circular-imageview

Last synced: 19 days ago
JSON representation

Circle image view :red_circle: and Avatar image view :smiley: for android

Awesome Lists containing this project

README

        

# Android Circular Image View
[![](https://jitpack.io/v/abdularis/CircularImageView.svg)](https://jitpack.io/#abdularis/CircularImageView)
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Circular%20Image%20View-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/6870)

This library provides you circle and avatar imageview for android. it automatically scale and center a bitmap based on the size of the view but does not copy the bitmap itself.

Read this article:
* [https://medium.com/@abdularis/android-custom-view-tutorial-create-circle-image-view-cacdd3e986cb](https://medium.com/@abdularis/android-custom-view-tutorial-create-circle-image-view-cacdd3e986cb)

## Screenshot
|![](demo.gif)|![](screenshots/screenshot.png)|
|-|-|

## Setup
- **Step 1** Add repository into root build.gradle

~~~gradle
allprojects {
repositories {
...
maven {
url 'https://jitpack.io' }
}
}
~~~

- **Step 2** Add library dependency into app build.gradle

> See the jitpack badge above for the latest version number

~~~gradle
dependencies {
implementation 'com.github.abdularis:circularimageview:'
}
~~~

## Usage
Check also the sample app

- **Creating circle image view**

![](screenshots/fig2.gif)

~~~xml

~~~

- **Creating avatar**

![](screenshots/fig1.gif)

You can choose either for avatar view state, IMAGE or INITIAL to show the first letter (default is INITIAL)

~~~xml

~~~

Java on view click listener

~~~java
// on click listener for avatar view 'A'
public void onAClick(View view) {
AvatarImageView a = (AvatarImageView) view;
if (a.getState() == AvatarImageView.SHOW_INITIAL) {
a.setState(AvatarImageView.SHOW_IMAGE);
} else {
a.setState(AvatarImageView.SHOW_INITIAL);
}
}
~~~

## XML Attributes

These are all attributes that you can use to customize the appearance of CircleImageView and AvatarImageView

~~~xml















~~~

## License
~~~
Copyright 2018 abdularis

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.
~~~