RTL layout bug in android Oreo

后端 未结 2 1623
刺人心
刺人心 2021-02-06 07:50

Ever since I upgraded to android oreo on mobile my RTL support for application is not working. it\'s changing the strings to Arabic but not changing layout direction. but if I r

2条回答
  •  春和景丽
    2021-02-06 08:34

    Simple fix in your onCreate function add the following code:

    if (Locale.getDefault().getLanguage()=="ar")
         getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
    else
         getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_LTR);
    

提交回复
热议问题