From 2cefd50ac3ada9bc8e31953c61cfa9a24aaaaa63 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Tue, 2 Jul 2024 18:06:56 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E5=90=88H5=E8=B0=83=E6=95=B4=E9=83=A8?= =?UTF-8?q?=E5=88=86webView=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yunbao/common/activity/AbsActivity.java | 4 ++-- .../com/yunbao/common/activity/WebViewActivity.java | 11 +++++++++++ common/src/main/res/layout/activity_webview.xml | 3 ++- .../com/yunbao/main/activity/ZhuangBanActivity.java | 8 ++++++++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/activity/AbsActivity.java b/common/src/main/java/com/yunbao/common/activity/AbsActivity.java index d9bc9e968..f4ac8a40b 100644 --- a/common/src/main/java/com/yunbao/common/activity/AbsActivity.java +++ b/common/src/main/java/com/yunbao/common/activity/AbsActivity.java @@ -59,7 +59,6 @@ public abstract class AbsActivity extends AppCompatActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { - create(); Intent intent = getIntent(); if (intent != null) { isFullWindow = getIntent().getBooleanExtra("isFull", false); @@ -68,6 +67,7 @@ public abstract class AbsActivity extends AppCompatActivity { getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); } } + create(); super.onCreate(savedInstanceState); mTag = this.getClass().getSimpleName(); setStatusBar(); @@ -133,7 +133,7 @@ public abstract class AbsActivity extends AppCompatActivity { /** * 设置透明状态栏 */ - private void setStatusBar() { + public void setStatusBar() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = getWindow(); diff --git a/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java b/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java index dc238840c..4a33c908c 100644 --- a/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java +++ b/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java @@ -5,6 +5,7 @@ import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; import android.content.Intent; +import android.graphics.Color; import android.net.Uri; import android.os.Build; import android.os.Handler; @@ -12,6 +13,7 @@ import android.provider.MediaStore; import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; +import android.view.WindowManager; import android.webkit.ValueCallback; import android.webkit.WebChromeClient; import android.webkit.WebSettings; @@ -82,6 +84,15 @@ public class WebViewActivity extends AbsActivity { return R.layout.activity_webview; } + + + @Override + public void setStatusBar() { + getWindow().setStatusBarColor(Color.parseColor("#FFFFFF")); + getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); + } + @Override protected void main() { String url = getIntent().getStringExtra(Constants.URL); diff --git a/common/src/main/res/layout/activity_webview.xml b/common/src/main/res/layout/activity_webview.xml index 44c9ef453..e22ab8281 100644 --- a/common/src/main/res/layout/activity_webview.xml +++ b/common/src/main/res/layout/activity_webview.xml @@ -17,8 +17,9 @@ android:layout_width="match_parent" android:layout_height="72dp" + android:background="@color/white" android:paddingTop="24dp" - android:background="@color/white"> + tools:visibility="gone">