Language Specific layout for android
The layout direction of your application. ldrtl
means "layout-direction-right-to-left"
. ldltr
means "layout-direction-left-to-right"
and is the default implicit value.
This can apply to any resource such as layouts, drawables
, or values
.
For example, if you want to provide some specific layout for the Arabic language
and some generic layout for any other "right-to-left" language (like Persian or Hebrew) then you would have:
res/
layout/
main.xml (Default layout)
layout-ar/
main.xml (Specific layout for Arabic)
layout-ldrtl/
main.xml (Any "right-to-left" language, except
for Arabic, because the "ar" language qualifier
has a higher precedence.)
Note: To enable right-to-left
layout features for your app, you must set supportsRtl
to "true"
and set targetSdkVersion to 17 or higher.
can we change our layout style when there is change of language.
Yes. You can provide different layouts according to the language user chooses. This is clearly described in the Providing Resources documentation.
Infact a specific layout qualifier is provided for supporting right-to-left-directed languages called res/layout-ldrtl
.
P.S: This attribute is only supported from API 17.