I am working on an application, using API 17 (4.2). In the application I am designing a layout class, and I would like to configure it according to the layout direction. However, I haven't been successful in retrieving the applied layout direction within the class:
LinearLayout layout = newLayout(context);
layout.setLayoutDirection(LAYOUT_DIRECTION_RTL);
int ld = layout.getLayoutDirection(); // STILL 0! I was expecting 1
My question is, how do I configure a layouts direction, and retrieve it within the class?
add this to your AndroidManifest.xml:
<application
...
android:supportsRtl="true"
>
As View checks RTL support first, if true, then resolve layout direction.
You can get more details in View.resolveLayoutDirection()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With