02-06-2013 03:09 PM
Is there a way to get the width and height of the current screen in QML?
Because I have to use the absolute layout and I also want to let the position of controller could fit with different dimension of screens, I plan to calculate the position based on the screen size to locate the controller to a relative position. In BB7 development, it is availabe to do this way. But I have not found how to realize it in BB10 QML.
Thank you someone can figure it out.
Solved! Go to Solution.
02-06-2013 03:34 PM
02-06-2013 03:40 PM - edited 02-06-2013 03:43 PM
Another option is to attach LayoutUpdateHandler to a container and reposition controls on updates. This way screen rotation won't break the layout.
https://developer.blackberry.com/cascades/referenc
02-06-2013 04:13 PM
Both your answers are so great. I got it. Thank you.
02-06-2013 04:21 PM
LayoutUpdateHandler is very useful. I can finally realize the complicated UI by that. If this methodology could be mentioned in the official documentation, i think that it will help the developers a lot.
02-06-2013 04:37 PM
very simple example
.
import bb.cascades 1.0
Page {
Container {
id: rootContainer
attachedObjects: [
LayoutUpdateHandler {
id: layoutHandler
}
]
Label {
text: layoutHandler.layoutFrame.width
}
}
}