Is it possible to make the browser field to fit to the actual size of the device screen?

StackOverflow https://stackoverflow.com/questions/13863946

  •  07-12-2021
  •  | 
  •  

質問

I'm using browser field2 to load the content of a URL inside the application. The data gets loaded successfully.

But my requirement is to shrink the data and display that in such a way that without any scrolling the entire content should be visible in the device screen.

When I googled, read that config.setProperty(BrowserFieldConfig.INITIAL_SCALE, new Float(0.1)); should do that. But it's not working for me.

I want to do this in a way that irrespective of the BB device, the content of the URL should fit to the device screen.

Any help would be much appreciated. Thanks in advance..!!

役に立ちましたか?

解決

In the HTML of the web page add the meta tag with the minimum scale set to 0

From the client side, we can shrink the web page using the initial scale method.

config.setProperty(BrowserFieldConfig.INITIAL_SCALE, new Float(value));

In my case, this meta tag was not there and so the initial scale option was not working after a certain limit. By this being set in the html, we can scale it to any value between the minimum/maximum defined scales.

With this, my problem was solved.

But, if you want to fit it to the device screen, you'll have to calculate the scale value to make it set to the screen size in all the devices irrespective of the resolutions.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top