CircularImageView

来源:互联网 发布:vscode 代码提示 编辑:程序博客网 时间:2024/06/05 15:52

CircularImageView

Custom view for circular images in Android while maintaining the best draw performance

Imgur

Usage

To make a circular ImageView, add this CircularImageView library to your project and add CircularImageView in your layout XML. You can also grab it via Gradle:

compile 'com.pkmmte.view:circularimageview:1.1'

or Maven:

<dependency>        <groupId>com.pkmmte.view</groupId>        <artifactId>circularimageview</artifactId>        <version>1.1</version></dependency>

XML

    <com.pkmmte.view.CircularImageView        android:layout_width="250dp"        android:layout_height="250dp"        android:src="@drawable/image"        app:border="true"        app:border_color="#EEEEEE"        app:border_width="4dp"        app:shadow="true" />

You may use the following properties in your XML to customize your CircularImageView.

Properties:
  • app:border (boolean) -> default false
  • app:border_color (color) -> default WHITE
  • app:border_width (dimension) -> default 2dp
  • app:selector (boolean) -> default false
  • app:selector_color (color) -> default TRANSPARENT
  • app:selector_stroke_color (color) -> default BLUE
  • app:selector_stroke_width (dimension) -> default 2dp
  • app:shadow (boolean) -> default false

JAVA

    CircularImageView circularImageView = (CircularImageView)findViewById(R.id.yourCircularImageView);    circularImageView.setBorderColor(getResources().getColor(R.color.GrayLight));    circularImageView.setBorderWidth(10);    circularImageView.setSelectorColor(getResources().getColor(R.color.BlueLightTransparent));    circularImageView.setSelectorStrokeColor(getResources().getColor(R.color.BlueDark));    circularImageView.setSelectorStrokeWidth(10);    circularImageView.addShadow();

Developed By

Pkmmte Xeleon - www.pkmmte.com

Follow me on Google+ Follow me on LinkedIn

License

The MIT License (MIT)Copyright (c) 2014 Pkmmte XeleonPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INTHE SOFTWARE.

Based on a work at https://github.com/lopspower/CircularImageView.

0 0
原创粉丝点击