How can I have one item of menu rtl and another one ltr?

时间秒杀一切 提交于 2020-05-22 09:44:13

问题


I have this menu:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
        <item
            android:id="@+id/choosemap"
            android:title="اولین آیتم"/>
        <item
            android:id="@+id/choosespinner"
            android:title="abc" />
</menu>

And this is output:

I want to have Persian title rtl and English title ltr (now both of them are ltr), how can I do this?


回答1:


Use right-to-left mark or even left-to-right mark in the string when it's needed,

left-to-right mark: &lrm; or &#x200e; (U+200E)
right-to-left mark: &rlm; or &#x200f; (U+200F)

explained here:

How to make the text direction from right to left

Example:

    android:title="\u200Fاولین آیتم"


来源:https://stackoverflow.com/questions/61692792/how-can-i-have-one-item-of-menu-rtl-and-another-one-ltr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!