-2

android navigation view is not working fine when language is arabic. This issue is only happened on 4.2.1 jelly bean. there is a alignment issue of icons.please take a look on screen shot
enter image description here

  • What is the issue please share more details, are you using custom list item ? – Mohamed Feb 26 '17 at 12:29
  • see the alignment of icons . all the icons should be on right side – Arslan Waheed Feb 26 '17 at 12:33
  • post your xml file, if you are using custom list item , if you are using relative layout change it to linear layout this flip happens with Arabic using relative layout. – Mohamed Feb 26 '17 at 12:34
  • i am using navigation view and iam getting all the items from menu folder – Arslan Waheed Feb 26 '17 at 12:36
  • i am not using custom view or listview – Arslan Waheed Feb 26 '17 at 12:37
  • great ! and you should put android:supportsRtl="true" in your application tag and force supporting right to left in you activity for jelly bean @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) private void forceRTLIfSupported() { if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1){ getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL); } } – Mohamed Feb 26 '17 at 12:38
  • @ArslanWaheed, take a look at this url: http://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/ and if you are menu, as the bottom view of your navigation drawer, use menu.xml, you can easily put your icons on left/right and text on the other end. PS: Please include more information (codes, layout designs etc) rather than just a screenshot. And take a look at this url as well. http://stackoverflow.com/help/how-to-ask – O_o Feb 26 '17 at 12:40
  • i already did this solution – Arslan Waheed Feb 26 '17 at 12:41

1 Answers1

0

You should put android:supportsRtl="true" inside your application tag and force supporting right to left in you activity for jelly bean in you activities like this :

         @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) 
private void forceRTLIfSupported() { 
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1){      getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DI‌​RECTION_RTL); 
} 
}
Mohamed
  • 761
  • 9
  • 19