作者 杨谦

1.直播网页显示报错问题

1 package com.br_technology.securitytrain_master.ui.view.mine.activity 1 package com.br_technology.securitytrain_master.ui.view.mine.activity
2 2
  3 +import android.view.View
3 import com.br_technology.securitytrain_master.databinding.ActivityLiveWebBinding 4 import com.br_technology.securitytrain_master.databinding.ActivityLiveWebBinding
4 import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.LiveWebViewModel 5 import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.LiveWebViewModel
  6 +import com.tencent.smtt.sdk.WebSettings
5 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity 7 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
6 8
7 /** 9 /**
@@ -19,10 +21,23 @@ class LiveWebActivity : @@ -19,10 +21,23 @@ class LiveWebActivity :
19 override fun initData() { 21 override fun initData() {
20 super.initData() 22 super.initData()
21 val url = intent.getStringExtra("url") ?: "" 23 val url = intent.getStringExtra("url") ?: ""
22 - val title = intent.getStringExtra("title")?:"" 24 + val title = intent.getStringExtra("title") ?: ""
23 binding.apply { 25 binding.apply {
24 toolBar.setTitle(title) 26 toolBar.setTitle(title)
25 liveWeb.loadUrl(url) 27 liveWeb.loadUrl(url)
  28 + liveWeb.apply {
  29 + settings.javaScriptEnabled = true
  30 + settings.useWideViewPort = true
  31 + settings.loadWithOverviewMode = true
  32 + settings.allowFileAccess = true
  33 + settings.layoutAlgorithm = WebSettings.LayoutAlgorithm.NARROW_COLUMNS
  34 + scrollBarStyle = View.SCROLLBARS_INSIDE_OVERLAY
  35 +
  36 + isScrollContainer = false
  37 + isVerticalScrollBarEnabled = false
  38 + isHorizontalScrollBarEnabled = false
  39 + setBackgroundColor(0); // 设置背景色
  40 + }
26 } 41 }
27 } 42 }
28 } 43 }