Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/AlbertGrobas/PolygonImageView
Custom ImageView for android with polygon shape (Android)
https://github.com/AlbertGrobas/PolygonImageView
Last synced: 2 months ago
JSON representation
Custom ImageView for android with polygon shape (Android)
- Host: GitHub
- URL: https://github.com/AlbertGrobas/PolygonImageView
- Owner: AlbertGrobas
- License: apache-2.0
- Created: 2014-07-27T10:51:26.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-04-17T15:47:52.000Z (almost 8 years ago)
- Last Synced: 2024-08-09T13:16:04.130Z (6 months ago)
- Language: Java
- Homepage:
- Size: 2.9 MB
- Stars: 544
- Watchers: 18
- Forks: 124
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-android-ui - https://github.com/AlbertGrobas/PolygonImageView
- awesome-android-ui - https://github.com/AlbertGrobas/PolygonImageView
README
PolygonImageView
===============Create a custom ImageView with polygonal forms.
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-PolygonImageView-brightgreen.svg?style=flat)](http://android-arsenal.com/details/1/1851)
![Demo Screenshot 1][1]
![Demo Screenshot 2][2]
![Demo Screenshot 3][3]Usage
-----To use PolygonImageView, add the module into your project and start to build xml or java.
### XML
```xml
```##### Properties:
* `app:poly_vertices` (integer) -> default 5
* `0` -> Circle
* `1` -> Regular ImageView, no affected by other properties
* `2` -> Square
* `>2` -> Polygon form
* `app:poly_shadow` (boolean) -> default false
* `app:poly_shadow_color` (color) -> default Black
* `app:poly_border` (boolean) -> default false
* `app:poly_border_color` (color) -> default White
* `app:poly_border_width` (dimension) -> default 4dp
* `app:poly_corner_radius` (float) -> default 0.0f
* `app:poly_rotation_angle` (float) -> default 0.0f### JAVA
```java
LinearLayout layout = (LinearLayout) findViewById(R.id.layout);
PolygonImageView view = new PolygonImageView(this);
view.setImageResource(R.drawable.cat);
view.addShadowResource(10f, 0f, 7.5f, R.color.shadow);
view.addBorderResource(5, R.color.border);
view.setCornerRadius(2);
view.setVertices(5);
view.setPolygonShape(new PaperPolygonShape(-15, 25));
layout.addView(view);
```### Effects
There are 3 basic effects:
* RegularPolygonShape
* PaperPolygonShape
* StarPolygonShapeCreate your own effect overriding BasePolygonShape or interface PolygonShape.
License
-------Copyright 2014 Albert Grobas
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 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.[1]: ./art/screen01.png
[2]: ./art/screen02.png
[3]: ./art/screen03.png