Search code examples
javaandroidandroid-studioandroid-actionbarandroid-support-library

Marked as private warning after changing colour of up arrow


After defining a custom colour for the back arrow in the action bar, a warning is then returned. What can be done to get rid of this warning?

        final Drawable upArrow = ContextCompat.getDrawable(this, R.drawable.abc_ic_ab_back_mtrl_am_alpha);
        upArrow.setColorFilter(Color.BLUE, PorterDuff.Mode.SRC_ATOP);
        actionBar.setHomeAsUpIndicator(upArrow);

The resource @drawable/abc_ic_ab_back_mtrl_am_alpha is marked as private in com.android.support:appcompat-v7


Solution

  • See Choose resources to make public for the reason.

    In short, drawable/abc_ic_ab_back_mtrl_am_alpha is a private resource of appcompat-v7 and is intended to be used only by that library. You should not use it.

    If you really want to use it, copy it to your project