Skip to content

Releases: youlookwhat/ByWebView

1.0.1

10 Jul 09:13
Compare
Choose a tag to compare

可设置自定义WebView,通过 setCustomWebViewLayout()方法。

注意:布局文件里使用固定的id = by_custom_webview
示例:

<?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/by_custom_webview"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

代码配置:

byWebView = ByWebView.with(this)
        .setWebParent(container, new LinearLayout.LayoutParams(-1, -1))
        .setCustomWebViewLayout(R.layout.layout_costom_webview) // 设置自定义WebView
        .useWebProgress(ContextCompat.getColor(this, R.color.coloRed))
        .addJavascriptInterface("injectedObject", new MyJavascriptInterface(this))
        .loadUrl(mUrl);