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

Java Development

Posts: 33
Registered: ‎11-01-2012
My Device: BlackBerry 9780, BlackBerry 10 Dev Alpha
My Carrier: Mobitel - Sri Lanka

How to code for horizontal scrolling for BrowserField in BB

I am new to BB development. I want to load a WebView inside my BB application without using the default device browser to load the URL. Following is the code I have used inside my BrowserScreen class which extends MainScreen.


BrowserField browserField = new BrowserField(myBrowserFieldConfig);


This will load the URL and display the web page without any error. Only issue is that web site is not developed specifically mobile devices. So the width of the web site is beyond the BB device screen. I can only scroll vertically not horizontally. How can I programmatically enable horizontal scrolling in BrowserField.


Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to code for horizontal scrolling for BrowserField in BB

By default, you probably added the BrowserField into a VerticalFieldManager, in which case it, by default, restricts the width to the screen width.  If you have just added your BrowserField to the MainScreen, then the same thing has happened. 


I think you can get away with just changing the Manager you add this to to have horizontal scrolling.


Probably the easiest thing to do is to create a HorizontalFieldManager which will scroll horizontally.  Add the BrowserField to this and then add this instead of adding the BrowserField to whatever you used to add the BrowserField too.


Let us know if this works.