首页 > 编程知识 正文

native和h5混合开发,开发android使用语言

时间:2023-05-06 17:23:01 阅读:182671 作者:1883

一个轻量级的库,加载html效果很好,而且功能很强大。那就是AgentWeb

GitHub地址:https://github.com/Justson/AgentWeb

GitHub上面介绍:

AgentWeb 是一个基于的 Android WebView ,极度容易使用以及功能强大的库,提供了 Android WebView 一系列的问题解决方案 ,并且轻量和极度灵活,体验请下载的 agentweb.apk, 或者你也可以到 Google Play 里面下载 AgentWeb , 详细使用请参照上面的 Sample 。

引入:

 api 'com.just.agentweb:agentweb:4.1.2' // (必选)
 api 'com.just.agentweb:filechooser:4.1.2'// (可选)
 api 'com.download.library:Downloader:4.1.2'// (可选)
我没有用下载功能,就只引用上面两个。

最基础的使用:

           mAgentWeb = AgentWeb.with(this).setAgentWebParent(layout, new LinearLayout.LayoutParams(-1, -1))
                            .useDefaultIndicator().createAgentWeb().ready().go("https://www.jd.com");
销毁:

    @Override
    protected void onPause() {
        super.onPause();
        if (mAgentWeb != null) {
            mAgentWeb.getWebLifeCycle().onDestroy();
        }
    }
 
    @Override
    protected void onResume() {
        super.onResume();
        if (mAgentWeb != null) {
            mAgentWeb.getWebLifeCycle().onResume();
        }
    }
这是我用到最基础的用法,详细用法以及介绍参考https://github.com/Justson/AgentWeb
 

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。