Welcome!

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

Reply
Developer
shahumang8
Posts: 643
Registered: ‎08-09-2010
My Device: Not Specified
Accepted Solution

How to set text fit in webview?

[ Edited ]

Hello,

 

  Any one know how to set text into full screen as per screen shot 2???

 

  Code

 

  

import bb.cascades 1.0

Page {
    Container {
        //Todo: fill me with QML
        ScrollView {
            id: scrollView
            scrollViewProperties {
                scrollMode: ScrollMode.Both
                minContentScale: 2
            }
            WebView {
                id: webView_Condiciones
                url: "local://assets/html/copy_Right.html"
            }
        }
    }
}

   Screen shot 1 (I got result like below)

 

   2013-10-21_2257.png

 

Screen Shot 2 (Need result like below)

 

test.png

 

So let me know which place i do wrong??

Please use plain text.
Developer
BBSJdev
Posts: 6,094
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: How to set text fit in webview?

Both HTML and CSS have 'justify' properties, which is hit and miss on browsers and untested by me on the BB10 but it's easy for you to see if they would work...

 

http://www.w3schools.com/tags/att_p_align.asp

 

 


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Developer
shahumang8
Posts: 643
Registered: ‎08-09-2010
My Device: Not Specified

Re: How to set text fit in webview?

Hi BBSJdev,

 

          As per my understanding there are no any relation of Justify with width.  I need like below

         They take fix width of phone and set page as per width. So let me know how can i do?? 

         

Please use plain text.
Developer
BBSJdev
Posts: 6,094
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: How to set text fit in webview?

You can set up a layoutupdatehandler to fix the width and height of a container that contains a control such as WebView...

 

http://developer.blackberry.com/native/reference/cascades/bb__cascades__layoutupdatehandler.html 


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Developer
shahumang8
Posts: 643
Registered: ‎08-09-2010
My Device: Not Specified

Re: How to set text fit in webview?

Not usefull. :No:

Please use plain text.
BlackBerry Development Advisor (Retired)
robbieDubya
Posts: 418
Registered: ‎07-18-2012
My Device: Q10
My Carrier: Bell Canada

Re: How to set text fit in webview?

Hi,

 

I think your problem is 

 minContentScale: 2

 

You're asking the ScrollView to zoom in on your web view... Zooming in will make it wider and taller...

 

If you just want bigger fonts, try something like this:

import bb.cascades 1.2

Page {
    Container {
        //Todo: fill me with QML
        ScrollView {
            id: scrollView
            scrollViewProperties {
                scrollMode: ScrollMode.Both
            }
            WebView {
                id: webView_Condiciones
                url: "local:///assets/index.html"
                settings.defaultFontSize: 32
            }
        }
    }
}

 With this HTML:

<html>
<body>
<div width="100%" style="text-align: center;">Hey There</div>
<ul>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing . . . . . . . .  .  ---8<-- SNIP -->8--

 I see:

IMG_00000228.png

 

--
Rob is no longer associated with BlackBerry.
Please use plain text.
Developer
shahumang8
Posts: 643
Registered: ‎08-09-2010
My Device: Not Specified

Re: How to set text fit in webview?

Thanks RobbieDubya.

 

Very help full.

Please use plain text.