dashman
dashman

Reputation: 3018

Getting page dimensions

On navigating to a new page, how do I get the dimensions of the page - the client/layout area only - exclude the action bar if present.

Will I get the same notification when the device orientation changes?

Thanks.

Upvotes: 0

Views: 663

Answers (1)

Dean Le
Dean Le

Reputation: 2094

Every view in NativeScript has a method call getMeasuredHeight() as well as getMeasuredWidth(). You can get the page dimensions like this:

var pageHeight, pageWidth;
pageHeight = page.getMeasuredHeight()- page.actionBar.getMeasuredHeight();
pageWidth = page.getMeasuredWidth()- page.actionBar.getMeasuredWidth();

Upvotes: 3

Related Questions