问号而不是 RTL 字段

Question mark instead of RTL field

我在我的项目中使用了这个Material Design Toolbar

但是我有两个问题:

  1. 当我为选项卡标题使用 RTL 字符串时,它没有正确显示字符串

    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"};
    

    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));
    

    这表明:

    1. 如何在 API 17 下使用 android:supportsRtl="true"?或从右侧打开 material 幻灯片菜单。 我将容器重力更改为 Right 并从右侧拖动正确打开,但是 return 通过工具栏中的切换打开时出错
  1. 看来问题出在源文件编码上。试试改成utf.
  2. 首先,您应该根据 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
  3. 进行更改

感谢@anil 最后我找到了解决问题的两种方法:

  1. 更改 Settings>File Encoding 中的源文件编码:

如果问题没有解决:

  1. 第一种方式 + 使用资源中的字符串 (R.String.nameOfString) 而不是直接在 Java 源代码中输入它们