Reputation: 101
I am creating an Arabic(RTL) app with NativeScript. I want the action bar to be sorted in rtl direction so the title is the right and menu options is to the left.
I tired using css and horizontalAlignment but nothing worked.
How can I achieve this?
Thank you.
Upvotes: 2
Views: 2397
Reputation: 7997
If you need RTL support due to language vs just "alignment" I would convert the entire app to RTL using android.view .View.LAYOUT_DIRECTION_RTL
:
This code will make the ActionBar ( and other components ) across the app to RTL
# app.module.ts
import {
android as Android,
AndroidActivityEventData,
AndroidApplication } from '@nativescript/core/application';
Android.addEventListener(AndroidApplication.activityCreatedEvent, (event: AndroidActivityEventData) => {
event.activity.getWindow().getDecorView().setLayoutDirection(android.view .View.LAYOUT_DIRECTION_RTL);
});
Upvotes: 0
Reputation: 1557
Example
<Page xmlns="http://schemas.nativescript.org/tns.xsd">
<Page.ActionBar>
<ActionBar >
<Label text="TITLE"/>
</ActionBar>
</Page.ActionBar>
</Page>
And with css u can set to right side with or other styling of ActionBar
ActionBar Label{
text-align:right;
horizontal-align:right;
}
Upvotes: 5