[TIMOB-24757] right-to-left floating views
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | dr@camindo.de |
Assignee | Unknown |
Created | 2017-05-29T17:15:10.000+0000 |
Updated | 2018-02-28T19:55:15.000+0000 |
Description
var myWindow = Ti.UI.createWindow({ backgroundColor: '#fff' });
myWindow.open();
var myContainer = Ti.UI.createView({
left: '0dp',
top: '80dp',
right: '0dp',
height: '200dp',
backgroundColor: '#ddd',
layout: 'horizontal'
});
myWindow.add(myContainer);
var div1 = Ti.UI.createLabel({
right: '20dp',
top:'10dp',
width: '100dp',
backgroundColor:'#ffeedd',
text:'DIV1'
});
myContainer.add(div1);
var div2 = Ti.UI.createLabel({
right: '15dp',
top:'10dp',
width: '100dp',
backgroundColor:'#ddeeff',
text:'DIV2'
});
myContainer.add(div2);
var div3 = Ti.UI.createLabel({
right: '10dp',
top:'10dp',
width: '100dp',
backgroundColor:'#ccffcc',
text:'DIV4'
});
myContainer.add(div3);
Hello, This is not a bug. For view layout set to horizontal the children are always laid horizontally from left to right. The left and right properties in child are used as padding between the children, and the top and bottom properties are used to position the children vertically. http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.View-property-layout. So, with horizontal layout child elements are always set from left to right. Remove horizontal layout from the parent view and calculate and set the right values in the child labels
Thanks for your answer. But in this case my views are not floating - e.g. if I have 50 div's. Can you please register this as a feature request. We have 2017 and apps in the arabic world have to work in a different way.
As a workaround I will calculate absolute positions and use eventHandler "postlayout" to check if device has been rotated. But it's a complex calculation. An attribute "rtl" additional to "layout" would help in future. Thanks for your investigation!
Ok, sure. I will forward this to engineering for future improvement.