【问题标题】:How to increase font size for webiew in android如何在android中增加webview的字体大小
【发布时间】:2011-12-18 13:22:39
【问题描述】:

如何在android中增加webiew的字体大小?我已经给出了下面的代码,但它不起作用。谁能告诉我怎么做?

blogWebView.getSettings().setDefaultFontSize(14);

【问题讨论】:

标签: android


【解决方案1】:

你可以在 webview 中使用缩放控制。见下面代码

  FrameLayout mContentView = (FrameLayout) getWindow().

    getDecorView().findViewById(android.R.id.content);

    final View zoom = this.mWebView.getZoomControls();

    mContentView.addView(zoom, ZOOM_PARAMS);

    zoom.setVisibility(View.GONE);


  private static final FrameLayout.LayoutParams ZOOM_PARAMS =

    new FrameLayout.LayoutParams(

    ViewGroup.LayoutParams.FILL_PARENT,

    ViewGroup.LayoutParams.WRAP_CONTENT,

    Gravity.BOTTOM);


 webview.getSettings().setDefaultZoom(WebSettings.ZoomDensity.FAR)

【讨论】:

    猜你喜欢
    • 2014-12-15
    • 2020-10-01
    • 2013-04-03
    • 2015-08-12
    • 2010-10-10
    • 2018-12-10
    • 2015-06-11
    • 2015-12-05
    • 2012-08-11
    相关资源
    最近更新 更多