当我将应用程序加载到设备中时,我的 Android 应用程序缓存大小约为 40MB,并且在第一次启动该应用程序时显示空白屏幕。我不知道如何解决这个挑战,请帮忙。
这些是我正在使用的库。
compile(group: 'com.microsoft.azure', name: 'azure-notifications-handler', version: '1.0.1', ext: 'jar')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.microsoft.azure.android:azure-storage-android:0.6.0@aar'
compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.3'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
最佳答案
您需要某种启动画面来在应用程序加载时娱乐用户。但是有一个问题……因为应用程序仍在加载,它如何运行任何代码来显示启动画面?事实上它不能真的,但幸运的是有一个解决方案:在加载期间,窗口管理器为您的应用程序绘制一个占位符 UI,使用主题中的元素,例如背景和状态栏颜色。正确设置主题可以让您即刻显示静态图像(尚未加载代码,因此此时没有花哨的动画)。关键是创建覆盖 android:windowBackground
属性的自定义主题,一旦您的应用程序加载并开始运行,您只需在调用 super.onCreate( )
在您的 Activity 中。
这是 Ian Lake 的 Google+ 帖子,详细描述了此技术:Use cold start time effectively with a branded launch theme .
关于android - 如何最小化Android应用程序缓存大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38717553/