Kiril
Kiril

Reputation: 6219

How to create a div to fit in webview in android

I am looking for an approach to fit a div element into a webview. The challenge is to scale the div to fit a webview on different Android devices.

WebView wv = (WebView)findViewById(R.id.webview);
String divElement = "<div style="width: 100px; height: 100px;> STUFF </div>";
wv.loadData(divElement, "text/html", "urf-8");

Question: How can I tell the WebView to "scale" to the 100px square which is created by the div? Or, are there better approaches to create the div?

Upvotes: 0

Views: 499

Answers (1)

Nick Andriopoulos
Nick Andriopoulos

Reputation: 10643

why don't you use width:100% (or any other proportion) for the div? does it need to have an absolute value?

Upvotes: 2

Related Questions