Android Library to dynamically change color of drawable.
If you like the library, please rate us on codix.io!
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
dependencies {
compile 'com.github.mathiazhagan01:DrawableColorChange:1.4'
}
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.mathiazhagan01</groupId>
<artifactId>DrawableColorChange</artifactId>
<version>1.4</version>
</dependency>
DrawableColorChange drawableColorChange = new DrawableColorChange(this);
drawableColorChange.setDrawable(R.drawable.icon);
drawableColorChange.setColorResId(R.color.colorAccent);
Drawable drawable = drawableColorChange.getColorChangedDrawable();
ImageView imageView = (ImageView) findViewById(R.id.image);
imageView.setImageDrawable(drawable);
imageView.setImageDrawable(drawableColorChange.changeColorById(R.drawable.icon, R.color.colorAccent));
drawableColorChange.setDrawable(R.drawable.icon);
drawableColorChange.setColorResId(R.color.colorAccent);
Bitmap bitmap = drawableColorChange.getColorChangedBitmap();
imageView.setImageBitmap(bitmap);
DrawableColorChange library for Android
Copyright (c) 2017 Mathiazhagan Dinesh (http://github.com/mathiazhagan01).
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 at
http://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.