Android

WebView的第三方组件—BridgeWebView的使用

2020-09-26  本文已影响0人  瑟闻风倾

BridgeWebView

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}
compile 'com.github.open-android:BridgeWebView:v1.0'
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.itheima.view.BridgeWebView
        android:id="@+id/activity_test_webView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
</LinearLayout>
package com.example.jackboard;

import android.os.Bundle;
import android.view.WindowManager;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.itheima.view.BridgeWebView;

public class TestActivity extends AppCompatActivity {

    private BridgeWebView webView;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);//隐藏状态栏
        setContentView(R.layout.activity_test);
        webView = (BridgeWebView)findViewById(R.id.activity_test_webView);
        String url = "http://mes.uchat.com.cn/board/line?deptid=1&name=youchan";//带Echarts图表的网址
        webView.loadUrl(url);//显示H5页面
    }
}

上一篇 下一篇

猜你喜欢

热点阅读