Auto Mirroring for RTL layout doesn't work in Android versions below 6.0 -


as know vector drawables added in android support library 23.2 announced in android developer blog versions of android can use instead of adding icons in different sizes. "enable auto mirroring rtl layout" option doesn't work in android versions below 6.0! there additional setting use in other android versions?

enter image description here

my test project uses simple method changing locale of application. these results of test:

nexus 6p android 6.0 works nice:

enter image description here enter image description here

nexus 7 android 5.0:

enter image description here enter image description here

thanks

bug reported: link

flip vector drawable if local arabic , drawable auto mirror

public static drawable getdrawablelocale(activity activity, @drawableres int drawableresid) {         if (!util.isrtl() || !resourcescompat.getdrawable(activity.getresources(), r.drawable.ic_back_white, null).isautomirrored())             return resourcescompat.getdrawable(activity.getresources(), r.drawable.ic_back_white, null);         /**          * flip rtl because kitkat doesn't flip          */         bitmap bitmap = util.getbitmapfromvectordrawable(activity, drawableresid);         matrix matrix = new matrix();         matrix.prescale(-1.0f, 1.0f);         bitmap = bitmap.createbitmap(bitmap, 0, 0, bitmap.getwidth(), bitmap.getheight(), matrix, true);         return new bitmapdrawable(activity.getresources(), bitmap);     }  public static bitmap getbitmapfromvectordrawable(context context, int drawableid) {     drawable drawable = getvectordrawable(context, drawableid);     if (build.version.sdk_int < build.version_codes.lollipop) {         drawable = (drawablecompat.wrap(drawable)).mutate();     }      bitmap bitmap = bitmap.createbitmap(drawable.getintrinsicwidth(),             drawable.getintrinsicheight(), bitmap.config.argb_8888);     canvas canvas = new canvas(bitmap);     drawable.setbounds(0, 0, canvas.getwidth(), canvas.getheight());     drawable.draw(canvas);      return bitmap; } public static drawable getvectordrawable(context context, @drawableres int idvectordrawable) {         return appcompatdrawablemanager.get().getdrawable(context, idvectordrawable);     }   public static boolean isrtl() {         return isrtl(locale.getdefault());     } public static boolean isrtl(locale locale) {     final int directionality = character.getdirectionality(locale.getdisplayname().charat(0));     return directionality == character.directionality_right_to_left ||             directionality == character.directionality_right_to_left_arabic; } 

Comments