change svg android drawable color

private void changeSearchDrawable() {
    Drawable drawable = ResourcesCompat.getDrawable(getResources(), R.drawable.icon_search, getTheme());
    int colorVal;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            colorVal = this.getResources().getColor(R.color.nnnow_pink, getTheme());
        } else {
            colorVal = this.getResources().getColor(R.color.nnnow_pink);
        }
    drawable.setColorFilter(colorVal, PorterDuff.Mode.SRC_ATOP);
    check.setImageDrawable(drawable);
}

Comments

Popular posts from this blog

Working with Android Hierarchy Viewer

RecyclerView item animation