2

I used this Material Design Toolbar for my project.

But I have 2 problems:

  1. When I use a RTL String for the Tabs Title, it doesn't show the String correctly

    private String titles[] = new String[]{"تست", "Sample Tab 2", "Sample Tab 3", "Sample Tab 4"
        , "Sample Tab 5", "Sample Tab 6", "Sample Tab 7", "Sample Tab 8"};
    

    Inside OnCreate:

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerList = (ListView) findViewById(R.id.navdrawer);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    if (toolbar != null) {
        setSupportActionBar(toolbar);
        toolbar.setNavigationIcon(R.drawable.ic_ab_drawer);
    }
    pager = (ViewPager) findViewById(R.id.viewpager);
    slidingTabLayout = (SlidingTabLayout) findViewById(R.id.sliding_tabs);
    pager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager(), titles));
    

    This shows:

    enter image description here

    1. How possible use android:supportsRtl="true" in under API 17? or opening material slide menu from right. I change the container gravity to Right and it opened correctly from Right side whit dragging , but return error with opening via Toggle in Toolbar
hichris123
  • 10,145
  • 15
  • 56
  • 70
Saeid
  • 2,261
  • 4
  • 27
  • 59

2 Answers2

1
  1. it seems the problem is in source file encoding. Try to change it to utf.
  2. first you should make changes described here. and as for pre-17 rtl-support see answers: How to handle RTL languages on pre 4.2 versions of Android? and Identifyng RTL language in Android
Community
  • 1
  • 1
anil
  • 2,083
  • 21
  • 37
0

Thanks to @anil Finally i find two way for problem :

  1. change source file encoding in Settings>File Encoding :

enter image description here

if problem not resolve :

  1. First way + Using Strings from resources (R.String.nameOfString) instead type them directly in Java source code
Saeid
  • 2,261
  • 4
  • 27
  • 59