我有一个webview,在其中我加载了Html。问题是,当它加载时,它看起来很小,并且不能正常适合屏幕。任何人都可以建议我解决这个问题吗?
myClass.class
mWebViewLayout.setVisibility(View.VISIBLE);
mWebView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
mWebView.setScrollbarFadingEnabled(false);
mWebView.setWebChromeClient(new WebChromeClient() {
});
WebSettings webSettings = mWebView.getSettings();
mWebView.getSettings().setAllowContentAccess(true);
webSettings.setPluginState(WebSettings.PluginState.ON);
mWebView.canGoBack();
final String html = "\n" +
"<!DOCTYPE html>\n" +
"<html>\n" +
" <head>\n" +
" <meta name=\"viewport\" content=\"width=device-width,target-densitydpi=device-dpi, initial-scale=1.0, maximum-scale=1.0\">\n" +
" <title>Interface\t</title>\n" +
" </head>\n" +
" <body>" +
myIframeRecieved
+ " </body></html>";
// mWebView.loadDataWithBaseURL(null, Select.from(VideoResource.class).where(Condition.prop("article_identifier").eq(selectedArticle.getArticleIdentifier())).first().getHtml(), "text/html", "UTF-8", null);
mWebView.loadData(html, "text/html; charset=UTF-8", null);
mWebView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadData(html, "text/html; charset=UTF-8", null);
return true;
}
public void onPageFinished(WebView view, String url) {
}
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
}
});
myIframeRecieved看起来像:
<iframe frameborder='0' allowfullscreen='' src='http://www.youtube.com/embed/AOr4zw59A34?rel=0'></iframe><div class='caption'></div><div class='copyright'></div><div class='clear'></div>
myIframeRecieved我无法修改,因为我从服务器
收到它现在,当我在webview中加载时,它看起来像this link
答案 0 :(得分:1)
尝试将SELECT TOP 1
BlogCategoryID AS 'CategoryID',
Language.Name AS 'Language',
dbo.BlogNameCategoryByLanguage(1,1) as 'Name',
dbo.Blog_PublishedInCategory(1,BlogCategory.ID) AS 'Published'
FROM
BlogCategoryTranslation
INNER JOIN
BlogCategory ON BlogCategory.ID = BlogCategoryTranslation.BlogCategoryID
INNER JOIN
Language ON Language.ID = BlogCategoryTranslation.LanguageID
WHERE
BlogCategoryID = 1
ORDER BY CASE WHEN Language.LanguageID = @LanguageID THEN 1 ELSE 2 END ASC
设置为width='100%' height='100%'
标记,看看这是否会改变布局。
尝试的另一个选择是从字符串中对url进行子串并将其传递给WebView;
这样的事情:
<iframe>