Android below 4.2 how to set layoutDirection to be RTL

后端 未结 3 912
情话喂你
情话喂你 2021-02-02 00:30

trying to set the layout elements to be RTL ordered

in 4.2 and above the line: layoutDirection=\"rtl\" and in the manifest: android:supportsRtl=\"true

3条回答
  •  灰色年华
    2021-02-02 00:42

    Just use ViewCompat using android.support.v4.view to do it.

    ViewCompat.setLayoutDirection(findViewById(R.id.my_view), ViewCompat.LAYOUT_DIRECTION_RTL);
    

提交回复
热议问题