Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Posts: 188
Registered: ‎07-19-2012
My Device: Z10 LE
My Carrier: Three

Automatically adjusting WebView height


I currently have a custom component that loads some html-formatted text from a JSON file and puts it into a WebView. As this text may contain an <img> tag, I cannot put it in a label. The problem I'm having is that the webview takes up the entire height of the screen, leaving a large amount of white space to scroll down through before reaching the next component.


Here is my QML:

Container {
    property alias heading: heading.text
    property alias content: content.html
    Label {
        id: heading
        objectName: "heading"
        textStyle {
            fontWeight: FontWeight.Bold
    WebView {
        id: content
        objectName: "content"
        horizontalAlignment: HorizontalAlignment.Fill
 	     settings {
 	         defaultFontSize: 16 

I can't use preferredHeight  or maxHeight as this will cause any text larger than the webview height to be cut off, and adding minHeight has no effect.


This is the expected result for the QML:




And this is the actual result due to the automatic height of the webview:



Any help would be greatly appreciated. Thanks.


Did this post help you? If so, please make sure to "like" it!
Posts: 75
Registered: ‎09-12-2012
My Device: Looking for a BB10 testing device
My Carrier: Developper

Re: Automatically adjusting WebView height

I got the same problem, did you solve it ?

May be a Cascades bug ?

Mobile developer freelance - QtQuick - Cascades - WP7 - Android
My works : http://fdelgado.fr
Posts: 34
Registered: ‎12-20-2010
My Device: DevAlpha Beta 2
My Carrier: Orange

Re: Automatically adjusting WebView height



I have the same issue.

Somebody has managed to fix it ?



New Contributor
Posts: 3
Registered: ‎04-01-2013
My Device: Dev Alpha B
My Carrier: N/A

Re: Automatically adjusting WebView height

No news on this?

New Developer
Posts: 12
Registered: ‎03-15-2013
My Device: simulator
My Carrier: 15975309089

Re: Automatically adjusting WebView height

just use layoutupdatehandler in the container