Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5010] Android: Center property cannot be set outside of createView method

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionNeeds more info
Resolution Date2017-06-07T19:24:38.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsn/a
ReporterBen Scofield
AssigneeShak Hossain
Created2017-06-02T21:55:07.000+0000
Updated2017-06-07T19:24:38.000+0000

Description

To reproduce: var win = Ti.UI.createWindow({ backgroundColor:'#ffffff', title:'Testing Center Property', fullscreen: true }); var box1 = Ti.UI.createView({ width: '120dp', height: '120dp', borderRadius: '12dp', center:{x:'70%', y:'50%'} }); box1.backgroundColor = "red"; var box2 = Ti.UI.createView({ width: '120dp', height: '120dp', borderRadius: '12dp' }); box2.backgroundColor = "blue"; box2.center = {x:'10%', y:'10%'}; win.add(box1); win.add(box2); win.open(); On iOS the behavior is as expected with the blue and red boxes centered on the points given. On Android the red box, where the center property is set *within *the createView method, is displayed correctly at the center point given. On android the blue box, where the center property is set *outside *the createView method, is shown at the point {x:'50%' , y:'50%'} as when no coordinates are given at all.

Comments

  1. Sharif AbuDarda 2017-06-05

    Hello, can you test this on SDK 6.1.0.GA? Thanks.

JSON Source