浏览代码

修改首页webview容器固定高度,由H5传入高度

Pq 3 月之前
父节点
当前提交
23eeb8213c
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      teacher/src/main/java/com/cooleshow/teacher/ui/web/ScHtmlFragment.java

+ 3 - 3
teacher/src/main/java/com/cooleshow/teacher/ui/web/ScHtmlFragment.java

@@ -343,14 +343,14 @@ public class ScHtmlFragment extends BaseFragment<FgScHomeWebBinding> implements
             return;
         }
         //为了规避H5页面的错误状态页比如404页面显示在了首页,所以这里在收到相应回调后更高布局样式
-        changeWebViewParentHeight();
+        changeWebViewParentHeight(height);
         showWebView();
     }
 
-    private void changeWebViewParentHeight() {
+    private void changeWebViewParentHeight(int height) {
         if (mViewBinding != null) {
             FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) mViewBinding.viewParent.getLayoutParams();
-            layoutParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
+            layoutParams.height = SizeUtils.dp2px(height);
             layoutParams.topMargin =SizeUtils.dp2px(12);
             mViewBinding.viewParent.setLayoutParams(layoutParams);
         }