Java Code Examples for android.webkit.WebSettings#ZoomDensity
The following examples show how to use
android.webkit.WebSettings#ZoomDensity .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TopSlidWebView.java From MyBlogDemo with Apache License 2.0 | 6 votes |
private void initSize(WebSettings settings) { int screenDensity = getResources().getDisplayMetrics(). densityDpi ; WebSettings.ZoomDensity zoomDensity = WebSettings.ZoomDensity. MEDIUM ; switch (screenDensity){ case DisplayMetrics.DENSITY_LOW : zoomDensity = WebSettings.ZoomDensity.CLOSE; break ; case DisplayMetrics.DENSITY_MEDIUM : zoomDensity = WebSettings.ZoomDensity.MEDIUM; break ; case DisplayMetrics.DENSITY_HIGH : zoomDensity = WebSettings.ZoomDensity.FAR; break ; } settings.setDefaultZoom(zoomDensity) ; }
Example 2
Source File: BaiduNewsDetailActivity.java From android-project-wo2b with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); mNewsTitle = intent.getStringExtra("news_title"); mNewsUrl = intent.getStringExtra("news_url"); setActionBarTitle(mNewsTitle); int screenDensity = getResources().getDisplayMetrics().densityDpi; WebSettings.ZoomDensity zoomDensity = WebSettings.ZoomDensity.MEDIUM; switch (screenDensity) { case DisplayMetrics.DENSITY_LOW: { zoomDensity = WebSettings.ZoomDensity.CLOSE; break; } case DisplayMetrics.DENSITY_MEDIUM: { zoomDensity = WebSettings.ZoomDensity.MEDIUM; break; } case DisplayMetrics.DENSITY_HIGH: { zoomDensity = WebSettings.ZoomDensity.FAR; break; } } // 设置默认缩放方式尺寸 getWebview().getSettings().setDefaultZoom(zoomDensity); getWebview().getSettings().setBuiltInZoomControls(true); getWebview().loadUrl(mNewsUrl); }
Example 3
Source File: WebViewSdkCompat.java From appcan-android with GNU Lesser General Public License v3.0 | 4 votes |
ZoomDensityCompat(WebSettings.ZoomDensity size) { value = size; }
Example 4
Source File: WebViewSdkCompat.java From appcan-android with GNU Lesser General Public License v3.0 | 4 votes |
public WebSettings.ZoomDensity getValue() { return value; }
Example 5
Source File: WebViewSdkCompat.java From appcan-android with GNU Lesser General Public License v3.0 | 4 votes |
ZoomDensityCompat(WebSettings.ZoomDensity size) { value = size; }
Example 6
Source File: WebViewSdkCompat.java From appcan-android with GNU Lesser General Public License v3.0 | 4 votes |
public WebSettings.ZoomDensity getValue() { return value; }