【发布时间】:2022-01-20 23:40:23
【问题描述】:
打开应用程序时所需的行为是:
- 显示初始屏幕并并行加载 URL
- 当加载时触发 javascript 界面时,只需删除启动屏幕
Mainactivity.java
myWebView.addJavascriptInterface(new JavaScriptInterface(this, cookieManager),"Android");
JavaScriptInterface.java
@JavascriptInterface
public void hideOrRemoveSplashScreen() {
objetcSplashScreen.doRemoveSplashScreen();
//...
}
HTML 页面(仅适用于应用程序加载的页面,应使用用户代理检测)
$(function() {
try{Android.hideOrRemoveSplashScreen()}catch(e){};
});
Activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/pullfresh"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<WebView
android:id="@+id/msw_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"></WebView>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
我不知道如何将一个简单的 .png 作为初始屏幕与应用程序的其余部分并行加载,然后,如何删除。
【问题讨论】:
标签: javascript android