I am attempting to display some formatted HTML inside of a webview. This HTML will have some basic formatting, such as images and paragraph tags etc.
The issue is that the HTML will take up the entire height of the screen. if I have some short content it take up the entire height of the screen.
What i want that height should adjust according to the content.
Does anyone know how I can get the height of the webview to work the way I want it to? Does this make sense?
os 7
This is my code.
HorizontalFieldManager contentview = new HorizontalFieldManager(Field.USE_ALL_WIDTH);
listVfm.add(contentview);
BrowserFieldConfig config = new BrowserFieldConfig();
config.setProperty(BrowserFieldConfig.VIEWPORT_WIDTH, new Integer(
Display.getWidth()));
config.setProperty(BrowserFieldConfig.INITIAL_SCALE, new Float(1.0));
config.setProperty(BrowserFieldConfig.USER_SCALABLE, Boolean.FALSE);
ProtocolController eventsProtocolController = new ProtocolController(bf2)
{
public void handleNavigationRequest(BrowserFieldRequest request) throws Exception
{
bf2.setFocus();
super.handleNavigationRequest(request);
}
};
config.setProperty(BrowserFieldConfig.CONTROLLER, eventsProtocolController);
bf2 = new BrowserField(config);
bf2.displayContent("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'><HTML><HEAD><META NAME='Generator' CONTENT='EditPlus'><META NAME='Author' CONTENT=''><META NAME='Keywords' CONTENT=''><META NAME='Description' CONTENT=''> <meta name='viewport' CONTENT='width=device-width,height=device-height,minimum-scale=1,content= maximum-scale=1, maximum-scale=1'/></HEAD><BODY><p>some text.</p></BODY></HTML>", "http://localhost");
contentview.add(bf2);