|
| 1 | +CircleImageView |
| 2 | +=============== |
| 3 | + |
| 4 | +A fast circular ImageView perfect for profile images. This is based on [RoundedImageView from Vince Mi](https://github.com/vinc3m1/RoundedImageView) which itself is based on [techniques recommended by Romain Guy](http://www.curious-creature.org/2012/12/11/android-recipe-1-image-with-rounded-corners/). |
| 5 | + |
| 6 | +TODO: add screenshot |
| 7 | + |
| 8 | +Compared to other solutions this |
| 9 | +* does **not** create a copy of the original bitmap |
| 10 | +* does **not** use a clipPath which is not hardware accelerated and not anti-aliased |
| 11 | +* does **not** use setXfermode to clip the bitmap and draw twice to the canvas |
| 12 | + |
| 13 | +I didn't split the library into a CircleImageView and a CircleDrawable so it can be used with all kinds of drawables, i.e. a PicassoDrawable from [Picasso](https://github.com/square/picasso) or other non-standard drawables (needs some testing though). |
| 14 | + |
| 15 | +Usage |
| 16 | +----- |
| 17 | +```xml |
| 18 | +<de.hdodenhof.circleimageview.CircleImageView |
| 19 | + xmlns:app="http://schemas.android.com/apk/res-auto" |
| 20 | + android:id="@+id/profile_image" |
| 21 | + android:layout_width="96dp" |
| 22 | + android:layout_height="96dp" |
| 23 | + android:src="@drawable/profile" |
| 24 | + app:border_width="2dp" |
| 25 | + app:border_color="#FF000000"/> |
| 26 | +``` |
| 27 | + |
| 28 | +Limitations |
| 29 | +----------- |
| 30 | +* The ScaleType is always CENTER_CROP and you'll get an exception if you try to change it. This is (currently) by design as it's perfectly fine for profile images. |
| 31 | +* Setters for border color and border width are missing |
| 32 | +* It's not yet on MavenCentral |
| 33 | + |
| 34 | +ChangeLog |
| 35 | +--------- |
| 36 | +* **1.0.0** |
| 37 | + * Initial release |
| 38 | + |
| 39 | +License |
| 40 | +------- |
| 41 | + |
| 42 | + Copyright 2014 Henning Dodenhof |
| 43 | + |
| 44 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 45 | + you may not use this file except in compliance with the License. |
| 46 | + You may obtain a copy of the License at |
| 47 | + |
| 48 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 49 | + |
| 50 | + Unless required by applicable law or agreed to in writing, software |
| 51 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 52 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 53 | + See the License for the specific language governing permissions and |
| 54 | + limitations under the License. |
0 commit comments