Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/abdularis/circularimageview
- Owner: abdularis
- License: apache-2.0
- Created: 2018-03-23T02:13:42.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-21T08:11:54.000Z (about 4 years ago)
- Last Synced: 2024-03-28T14:34:19.912Z (8 months ago)
- Topics: android, android-imageview, android-library, circular-imageview
- Language: Kotlin
- Homepage:
- Size: 1.11 MB
- Stars: 90
- Watchers: 3
- Forks: 15
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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 abdularisLicensed 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 athttp://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.
~~~