uniwebview使用-java和js相互调用

解决问题:项目中需要内嵌浏览器,因此学习一番。

我是用Android Studio进行学习。

我是用uniwebview进行学习的。也是基于此做个爬坑记录。

uniwebview的工作流程主要是:1.先初始化数据。2.显示界面。3.关闭界面。

1.初始化数据,

           
        var listenerObject = new GameObject(id);
        //UniWebViewNativeListener   是用来监听java端返回数据
        listener = listenerObject.AddComponent<UniWebViewNativeListener>();
        listenerObject.transform.parent = transform;
        listener.webView = this;
        UniWebViewNativeListener.AddListener(listener);
        fullScreen = true;
        Rect rect; 
        if (fullScreen)
        {
            rect = new Rect(0, 0, ShowWidth, ShowHeight);
        }
        else
        {
            rect = NextFrameRect();
        }
        //这里是初始化
        UniWebViewInterface.Init(listener.Name, (int)rect.x, (int)rect. y, (int)rect.width, (int)rect.height);  
        isPortrait = Screen.height >= Screen.width;

先暂时到这,以后在更吧

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值