心动空间 优化帮助。
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
package com.xscm.modulemain.dialog
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import com.xscm.modulemain.R
|
||||
import com.xscm.modulemain.databinding.WebviewDialogBinding
|
||||
import com.xscm.moduleutil.base.CommonAppContext
|
||||
import com.xscm.moduleutil.widget.dialog.BaseDialog
|
||||
|
||||
class DialogWebView(context: Context) : BaseDialog<WebviewDialogBinding>(context) {
|
||||
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.webview_dialog
|
||||
}
|
||||
|
||||
override fun initView() {
|
||||
mBinding.webview.setBackgroundColor(Color.TRANSPARENT)
|
||||
|
||||
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
mBinding.ivBack.setOnClickListener {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示网页内容的方法
|
||||
* @param url 要加载的网页URL地址
|
||||
*/
|
||||
fun show(url:String) {
|
||||
// 调用父类的show方法
|
||||
super.show()
|
||||
// 调用setWebView方法加载指定URL的网页
|
||||
setWebView(url)
|
||||
}
|
||||
|
||||
private fun setWebView(url: String) {
|
||||
mBinding.webview.getSettings().setJavaScriptEnabled(true)
|
||||
mBinding.webview.loadUrl(url)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user