|
[superwebview]
android跳转继承ExternalActivity的类时黑屏
[复制链接]
公司android项目才用的是superwebview+原生的方式开发,项目中的配置也是按照官方的文档集合demo一步一步集成的。也能成功运行。但是跳转到继承ExternalActivity的activity类时就会出现几秒的黑屏和白屏才能正常显示widget中的HTML页面。
项目的开发方式:vue+superwebview+原生
问题:跳转到ExternalActivity类出现几秒黑屏和白屏
代码主要配置
AndroidManifest.xml
- <--次Activity集成ExternalActivity-->
复制代码 android冷启动配置
- <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
- <!-- Customize your theme here. -->
- <item name="colorPrimary">@color/colorPrimary</item>
- <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
- <item name="colorAccent">@color/colorAccent</item>
- </style>
- <!--冷启动引道背景-->
- <style name="AppSplashBG" parent="android:Theme.NoTitleBar.Fullscreen">
- <item name="android:windowBackground">@drawable/splash_bg_layer_list</item>
- </style>
复制代码 Activity代码配置
- public class HongBaoActivity extends ExternalActivity {
- private static final String TAG = "HongBaoActivity";
- private IExternalImpl iExternal;
- @Override
- public void onCreate(Bundle savedInstanceState) {
- // setTheme(R.style.AppTheme);
- super.onCreate(savedInstanceState);
- // setContentView(R.layout.activity_hong_bao);
- iExternal = new HongBaoExternal();
- //初始化常用Appkey
- try {
- String fileJson = AppUtils.fileJson(getApplicationContext(), "appkeys.json");
- HongBaoExternal.getLocalAppkeys(HongBaoActivity.this, fileJson);
- } catch (Exception e) {
- e.printStackTrace();
- }
- addHtml5EventListener(HongBaoExternal.getHtml5EventListener("testApiCloud"));
- }
- /**
- * 重写该函数,可实现处理收到来自Html5页面的操作请求,处理完毕后异步回调至Html5
- */
- @Override
- protected boolean onHtml5AccessRequest(WebViewProvider provider, UZModuleContext moduleContext) {
- return iExternal.onHtml5AccessRequest(provider, moduleContext);
- }
- }
复制代码
vue项目中config的app.js文件配置
- module.exports = {
- build: {
- env: require("./prod.env"),
- index: path.resolve(__dirname, "../widget/index.html"),
- assetsRoot: path.resolve(__dirname, "../widget/index.html"),
复制代码
|
|