android - Convert dp values to px values usable inside WebView (dp to CSS px) -
I am creating an HTML page from scratch and dynamically inserting it into a value, a WebView .
I am trying to replicate the
WebView (inside html) in the
I also know the text of the
actionbar and its title inside.
I like
dimens such a folder ...
mTitleSize = res.getDimensionPixelSize (R.dimen.actionbar_title_text); // 50dp mActionbarH = res.getDimensionPixelSize (R.dimen.actionbar_height); // 25sp
... and by placing them in the html file's CSS.
My problem is that the values above are really big. The height of the action bar and the size of the text are very large, the same
dimens values are used to display the actionbars in the rest of the app (not webview, but original Android
see inside a
relative layout ) and they look great.
Then ... I'm converting
50dp and
25sp values into pixels, not within a single country, see
Inside and
WebView ? Is the webpage provided in a different way than the original page?
If so, then value
dp in
px
webview and still seeing as the rest of the application ?
I got it
i.e.
< code> res.getDimensionPixelSize (R.dimen.actionbar_height) / res.getDisplayMetrics (). Density
... and the value as CSS in px
Was set.
Comments
Post a Comment