本文整理了Java中android.webkit.WebView.layout()
方法的一些代码示例,展示了WebView.layout()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebView.layout()
方法的具体详情如下:
包路径:android.webkit.WebView
类名称:WebView
方法名:layout
暂无
代码示例来源:origin: stackoverflow.com
View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED),
View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
webView.layout(0, 0, webView.getMeasuredWidth(),
webView.getMeasuredHeight());
webView.setDrawingCacheEnabled(true);
代码示例来源:origin: stackoverflow.com
MeasureSpec.makeMeasureSpec((p.x < p.y ? p.x : p.y),
MeasureSpec.EXACTLY));
webView.layout(0, 0, webView.getMeasuredWidth(), webView.getMeasuredHeight());
代码示例来源:origin: stackoverflow.com
w.layout(0, 0, rect.width(), rect.height());
w.loadDataWithBaseURL(baseURL, content, "text/html", "UTF-8", null);
}});
代码示例来源:origin: stackoverflow.com
MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED),
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
webView.layout(0, 0, webView.getMeasuredWidth(),
webView.getMeasuredHeight());
webView.setDrawingCacheEnabled(true);
代码示例来源:origin: stackoverflow.com
final WebView webView = new WebView(context);
webView.loadDataWithBaseURL("", html, "text/html", "utf-8", null);
webView.layout(0, 0, desiredWidth, desiredHeight);
webView.setWebViewClient(new CustomtWebClient(context));
代码示例来源:origin: stackoverflow.com
public void initWebView() {
WebView wview;
wview = new WebView(getApplicationContext());
//Add the WebView to the current window
((WindowManager)getApplicationContext().getSystemService("window")).addView(wview, new WindowManager.LayoutParams(300, 300));
wview.clearHistory();
wview.clearCache(true);
wview.getSettings().setJavaScriptEnabled(true);
wview.getSettings().setPluginsEnabled(true);
wview.getSettings().setPluginState(WebSettings.PluginState.ON);
wview.getSettings().setRenderPriority(RenderPriority.HIGH);
wview.setWebViewClient(new WebViewClient()
{
public void onPageFinished(WebView view, String url)
{
//Callback for when pages are finished loading
wview.layout(0, 0, (int)DESIRED_WIDTH, (int)DESIRED_HEIGHT);
}
public void onPageStarted(WebView view, String url, Bitmap favicon)
{
//Callback for when pages are being loaded
}
});
wview.loadUrl("http://blog.ascensionsystems.ca/");
}
代码示例来源:origin: stackoverflow.com
public static Bitmap screenshot2(WebView webView) {
webView.measure(MeasureSpec.makeMeasureSpec(
MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED),
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
webView.layout(0, 0, webView.getMeasuredWidth(), webView.getMeasuredHeight());
webView.setDrawingCacheEnabled(true);
webView.buildDrawingCache();
Bitmap bitmap = Bitmap.createBitmap(webView.getMeasuredWidth(),
webView.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint();
int iHeight = bitmap.getHeight();
canvas.drawBitmap(bitmap, 0, iHeight, paint);
webView.draw(canvas);
return bitmap;
}
代码示例来源:origin: LonamiWebs/Stringlate
/**
* Create a picture out of {@link WebView}'s whole content
*
* @param webView The WebView to get contents from
* @return A {@link Bitmap} or null
*/
@Nullable
public static Bitmap getBitmapFromWebView(WebView webView) {
try {
//Measure WebView's content
int widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
webView.measure(widthMeasureSpec, heightMeasureSpec);
webView.layout(0, 0, webView.getMeasuredWidth(), webView.getMeasuredHeight());
//Build drawing cache and store its size
webView.buildDrawingCache();
int measuredWidth = webView.getMeasuredWidth();
int measuredHeight = webView.getMeasuredHeight();
//Creates the bitmap and draw WebView's content on in
Bitmap bitmap = Bitmap.createBitmap(measuredWidth, measuredHeight, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
canvas.drawBitmap(bitmap, 0, bitmap.getHeight(), new Paint());
webView.draw(canvas);
webView.destroyDrawingCache();
return bitmap;
} catch (Exception | OutOfMemoryError e) {
e.printStackTrace();
return null;
}
}
代码示例来源:origin: upyun/android-player-sdk
webview.layout(0, 0, 0, 0);
WebSettings settings = webview.getSettings();
this.ua = settings.getUserAgentString();
内容来源于网络,如有侵权,请联系作者删除!