Friday 15 July 2011

html - webpages fits on all android devices -



html - webpages fits on all android devices -

i'm developing android project in consists of several activities each activity consists of webviews.i used html file , css accomplish this.but webpages different in different android devices.i dont want horizontal scrolling,it must automatically adapt devices.how possible?can 1 find me solution regarding this??

my webview.xml

<webview android:layout_width="fill_parent" android:layout_height="fill_parent" android:scrollbars="none" android:id="@+id/webview" />

my java code

webview web=(webview)findviewbyid(r.id.webview); web.getsettings().setlayoutalgorithm(layoutalgorithm.single_column); web.loadurl("file:///android_asset/www/cube.html");

my cube.html file

<!doctype html> <html> <head> <meta charset="iso-8859-1"> <title>introduction</title> <link rel="stylesheet" href="mystyles.css" type="text/css" /> </head> <body> <div class="section"> <h2>cube root of unity</h2> <p>as discussed in previous section cube roots of unity <mark class= "bold">1, &#x03c9 , &#x03c9<sup> 2</sup></mark> <mark class= "bold">&#x03c9 =e<sup>i2&#x3c0;/3</sup> = -1/2 + &#x221a;3/2 , &#x03c9<sup>2</sup> = e<sup>i4&#x3c0;/3</sup> = -1/2 -i &#x221a;3/2.</mark> shall obtain cube roots of unity alternative method.</p> </div> </body></html>

and css file

h2 { font-family: "times new roman",times,serif; color: #002671; font-size: 23px; font-weight: bold; border-bottom: 2px solid #ccc; padding-bottom: 7px; margin: 24px 0px 0px; }

you might wanna seek putting name="viewport" content="width=device-width, user-scalable=no" in <meta>-container of html file. ;)

this shoud resize document , prevent user zooming, in end you'll have document scrollable vertically.

android html css

No comments:

Post a Comment