ListView layout inconsistent rendering with RTL languages (Arabic)

后端 未结 6 1296
鱼传尺愫
鱼传尺愫 2021-01-17 23:44

I have simple ListView with ArrayAdapter which is working just fine. The problems start with RTL language (Arabic in this case).

W

6条回答
  •  余生分开走
    2021-01-17 23:51

    To support RTL alignment you first need to add android:supportsRtl="true" to the element in your manifest file.

    Major thing:-

    • If your app only supports API ≥ 17, replace all the layout_marginLeft/layout_marginRight/paddingLeft/paddingRight or any other Left and Right layout property with Start and End equivalent. For example android:paddingLeft will be replaced with android:paddingStart.
    • If your app supports API<17 then instead of replacing the Left and Right layout properties, add their Start and End layout property equivalent alongside.

    Or you can just do for all layouts using Android Studio > Refactor > Add RTL support where possible…

    For more references on RTL follow this article for drawables as well here It will surely solve your problem using each step.

提交回复
热议问题