albertgrobas / polygonimageview Goto Github PK
View Code? Open in Web Editor NEWCustom ImageView for android with polygon shape (Android)
License: Apache License 2.0
Custom ImageView for android with polygon shape (Android)
License: Apache License 2.0
When i am setting Scaletype Imageview got invible.
In some cases (when uses special effects like start with concave true) polygon shape is out of bounds.
In 2.3.3 works correctly...
hi albert thanks for this very nice lib.
i use it in my app but in api 21 polygone shows black background or transparent even if have parent with colored background.
this is my code
PolygonImageView view = new PolygonImageView(getApplicationContext());
view.setImageResource(R.color.info_MainBackColor);
view.addBorderResource(5, R.color.info_MainBackColor);
view.setCornerRadius(2);
view.setVertices(6);
imageLayout.addView(view);
this is my layout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mainlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/amber_600"
RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mainlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/amber_600"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/imageLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp">
</RelativeLayout>
</LinearLayout>
I am trying apply colour filters to the PolygonImageViews but they are not working.
My code:
ColorMatrix cm = new ColorMatrix();
cm.setSaturation(0);
ColorMatrixColorFilter filter = new ColorMatrixColorFilter(cm);
view.setColorFilter(filter);
Any help would be appreciated.
In lollipop if I use a square image a black square appears behind.
Removing setLayerType solves the problem but shadowing is not working.
//Avoid known shadow problems
if (Build.VERSION.SDK_INT > 13)
setLayerType(LAYER_TYPE_SOFTWARE, mBorderPaint);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.