5

से नीचे एंड्रॉइड संस्करणों में काम नहीं करता है जैसा कि आप जानते हैं कि वेक्टर ड्रायबल्स को एंड्रॉइड सपोर्ट लाइब्रेरी 23.2 में जोड़ा गया था, जिसने Android Developer Blog में घोषणा की कि एंड्रॉइड के सभी संस्करणों के लिए हम अलग-अलग आइकन जोड़ने के बजाय इसका उपयोग कर सकते हैं आकार। हालांकि "आरटीएल लेआउट के लिए ऑटो मिररिंग सक्षम करें" विकल्प 6.0 से नीचे एंड्रॉइड संस्करणों में काम नहीं करता है! क्या अन्य एंड्रॉइड संस्करणों में इसका उपयोग करने के लिए कोई अतिरिक्त सेटिंग है?आरटीएल लेआउट के लिए ऑटो मिररिंग 6.0

enter image description here

मेरे टेस्ट परियोजना अपने आवेदन की स्थान बदलने के लिए एक सरल विधि का उपयोग करता। एंड्रॉयड 5.0 के साथ

enter image description here enter image description here

नेक्सस 7: के साथ एंड्रॉयड 6.0

Nexus 6P जो अच्छा काम करता है: ये अपने परीक्षण के परिणाम हैं

enter image description here enter image description here

धन्यवाद

+0

किसी भी सवाल का जवाब कृपया? दुर्भाग्य से –

+0

@mostafahashim, ऐसा लगता है कि यह सुविधा 6.0 से नीचे एंड्रॉइड संस्करण में समर्थित नहीं है। मैं 'mipmap' में अलग-अलग' mipmap' का उपयोग करता हूं और प्रत्येक आइकन के लिए 'mipmap-ldrtl' फ़ोल्डरों को स्थानीय का पालन करना होगा। अन्य आइकनों के लिए मैं 'वेक्टर ड्रायबल' का उपयोग करता हूं। – Nava

उत्तर

0

बग रिपोर्ट किया गया: link

फ्लिप वेक्टर drawable यदि स्थानीय अरबी और drawable ऑटो दर्पण

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 it for 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; 
} 
0

आप कस्टम imageView बनाने का उपयोग कर सकते है और अगर फारसी घुमाने 180.

संबंधित मुद्दे