Direction

API Reference: UI.FlexLayout.Direction

Direction is used to align objects right-to-left or left-to-right.

Direction.INHERIT is based on the language settings of the mobile device. If the the device language is a left-to-right language (such as English), the direction will be LTR. If the the device language is a right-to-left language (such as Arabic), the direction will be RTL.

JavaScript
JavaScript
const Page = require("sf-core/ui/page");
const extend = require("js-base/core/extend");
const FlexLayout = require('sf-core/ui/flexlayout');
const Color = require('sf-core/ui/color');
const TextAlignment = require('sf-core/ui/textalignment');
const Label = require('sf-core/ui/label');
var Page1 = extend(Page)(
function(_super) {
_super(this, {
onShow: function(params) {
Application.statusBar.visible = false;
this.headerBar.visible = false;
}
});
this.layout.flexDirection = FlexLayout.FlexDirection.ROW;
this.layout.justifyContent = FlexLayout.JustifyContent.CENTER;
this.layout.alignItems = FlexLayout.AlignItems.CENTER;
var myFlexLayout = new FlexLayout({
top: 0,
left: 0,
bottom: 0,
right: 0,
positionType: FlexLayout.PositionType.ABSOLUTE,
direction:FlexLayout.Direction.LTR,
backgroundColor: Color.WHITE
})
this.layout.addChild(myFlexLayout);
var label1 = new Label({
width: 80,
height: 80,
text: "1",
textAlignment: TextAlignment.MIDCENTER,
backgroundColor: Color.create("#32a80b")
})
var label2 = new Label({
width: 80,
height: 80,
text: "2",
textAlignment: TextAlignment.MIDCENTER,
backgroundColor: Color.create("#8f44ad")
})
myFlexLayout.addChild(label1);
myFlexLayout.addChild(label2);
}
);
module.exports = Page1;

Direction.LTR

Direction.RTL

Direction.INHERIT