- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的android应用程序有一个严重的问题,当activity恢复多次(大约10次)时,activity在滚动时会变得卡顿。如果我开始一项新 Activity ,新 Activity 会顺利进行,但如果我让它恢复大约 10 次,它也会像第一次一样变得滞后。我尝试过使用简单的 UI,只有一个 ScrollView
和几个 TextView
。下面是我的类实现:
public class TestLagActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test);
}
@Override
protected void onResume() {
super.onResume();
}
@Override
public void onBackPressed() { //make activity resume when press back button
for(int i=0;i<11;i++)
onResume();
}
}
有人遇到过这样的情况吗?你能告诉我一些可能导致这样的问题的原因吗?如果您需要更多代码,请告诉我,我会提供给您。
提前致谢!
更新:当我按下后退按钮使 Activity 恢复时(参见上面的 onBackPressed() 方法), Activity 滞后,logcat 显示:
2020-03-13 21:53:42.731 22255-22314/com.mypackagename.dev V/FA: Inactivity, disconnecting from the service
2020-03-13 21:53:44.279 22255-22255/com.mypackagename.dev D/KeyEvent: obtain, mHwFlags=1768911460
2020-03-13 21:53:44.286 22255-22255/com.mypackagename.dev D/KeyEvent: obtain, mHwFlags=1768911460
2020-03-13 21:53:44.290 22255-22314/com.mypackagename.dev V/FA: Activity resumed, time: 16148835
2020-03-13 21:53:44.307 22255-22314/com.mypackagename.dev V/FA: Connecting to remote service
2020-03-13 21:53:44.311 22255-22314/com.mypackagename.dev V/FA: Activity resumed, time: 16148846
2020-03-13 21:53:44.328 22255-22314/com.mypackagename.dev V/FA: Connection attempt already in progress
2020-03-13 21:53:44.328 22255-22314/com.mypackagename.dev V/FA: Activity resumed, time: 16148855
2020-03-13 21:53:44.345 22255-22314/com.mypackagename.dev V/FA: Connection attempt already in progress
2020-03-13 21:53:44.346 22255-22314/com.mypackagename.dev V/FA: Activity resumed, time: 16148867
2020-03-13 21:53:44.362 22255-22314/com.mypackagename.dev V/FA: Connection attempt already in progress
2020-03-13 21:53:44.363 22255-22314/com.mypackagename.dev V/FA: Activity resumed, time: 16148876
2020-03-13 21:53:44.379 22255-22314/com.mypackagename.dev V/FA: Connection attempt already in progress
2020-03-13 21:53:44.380 22255-22314/com.mypackagename.dev V/FA: Activity resumed, time: 16148887
2020-03-13 21:53:44.397 22255-22314/com.mypackagename.dev V/FA: Connection attempt already in progress
2020-03-13 21:53:44.397 22255-22314/com.mypackagename.dev V/FA: Activity resumed, time: 16148896
2020-03-13 21:53:44.413 22255-22314/com.mypackagename.dev V/FA: Connection attempt already in progress
2020-03-13 21:53:44.414 22255-22314/com.mypackagename.dev V/FA: Activity resumed, time: 16148907
2020-03-13 21:53:44.427 22255-22314/com.mypackagename.dev V/FA: Connection attempt already in progress
2020-03-13 21:53:44.428 22255-22314/com.mypackagename.dev V/FA: Activity resumed, time: 16148921
2020-03-13 21:53:44.432 22255-22290/com.mypackagename.dev I/zygote64: Starting profile saver IsSaveProfileNow end.
2020-03-13 21:53:44.440 22255-22314/com.mypackagename.dev V/FA: Connection attempt already in progress
2020-03-13 21:53:44.441 22255-22314/com.mypackagename.dev V/FA: Activity resumed, time: 16148930
2020-03-13 21:53:44.453 22255-22314/com.mypackagename.dev V/FA: Connection attempt already in progress
2020-03-13 21:53:44.454 22255-22314/com.mypackagename.dev V/FA: Activity resumed, time: 16148942
2020-03-13 21:53:44.466 22255-22314/com.mypackagename.dev V/FA: Connection attempt already in progress
2020-03-13 21:53:44.467 22255-22314/com.mypackagename.dev D/FA: Connected to remote service
2020-03-13 21:53:44.470 22255-22314/com.mypackagename.dev V/FA: Processing queued up service tasks: 11
2020-03-13 21:53:44.549 22255-22262/com.mypackagename.dev I/zygote64: Do partial code cache collection, code=251KB, data=151KB
2020-03-13 21:53:44.549 22255-22262/com.mypackagename.dev I/zygote64: After code cache collection, code=251KB, data=151KB
2020-03-13 21:53:44.549 22255-22262/com.mypackagename.dev I/zygote64: Increasing code cache capacity to 1024KB
更新 2: Activity 的 xml 文件:
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:text="@string/verify" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:text="@string/verify" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:text="@string/verify" />
<!--Other TextViews-->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:text="@string/verify" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:text="@string/verify" />
</LinearLayout>
更新 3:项目中使用的依赖项。
implementation 'io.supercharge:shimmerlayout:2.1.0'
implementation 'com.facebook.shimmer:shimmer:0.5.0'
implementation "com.rizlee.view:rangeseekbar:1.0.0"
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'com.mikhaellopez:circularimageview:3.0.2'
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation 'com.github.florent37:singledateandtimepicker:1.2.2'
implementation 'me.relex:circleindicator:1.2.2@aar'
implementation 'com.wang.avi:library:2.1.3'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.facebook.android:facebook-android-sdk:5.11.0'
implementation 'com.facebook.android:account-kit-sdk:4.39.0'
implementation 'com.facebook.android:facebook-share:5.11.0'
implementation 'com.google.android.gms:play-services-base:17.1.0'
implementation 'com.google.android.gms:play-services-analytics:17.0.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-vision:19.0.0'
implementation 'com.google.android.libraries.places:places:2.2.0'
implementation 'com.google.android.gms:play-services-places:17.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.maps.android:android-maps-utils:0.5'
implementation 'com.google.android.gms:play-services-plus:17.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
implementation 'com.google.firebase:firebase-analytics:17.2.3'
implementation 'com.google.firebase:firebase-auth:19.3.0'
implementation 'com.google.firebase:firebase-firestore:21.4.1'
implementation 'com.google.firebase:firebase-messaging:20.1.2'
implementation 'com.appsflyer:af-android-sdk:4.9.0'
implementation 'com.android.installreferrer:installreferrer:1.1.2'
implementation(name:'HERE-sdk-lite', ext:'aar')
implementation 'io.branch.sdk.android:library:4.4.0'
最佳答案
一周后,我发现 implementation 'com.facebook.android:facebook-android-sdk:5.11.0'
使我的应用程序中的 Activity 在恢复后变得滞后。我用这个 answer 解决了
关于java - 多次恢复时 Activity 滚动不流畅,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60644439/
我想在单击按钮时进行移动:向左。这是针对移动运动的... 问题在于它的移动,但只有一次。我需要点击按钮发送垃圾邮件... 代码: 在创建中: this.buttonleft.inputEnabled
前言 今天大姚给大家分享一个.NET开源(MIT License)、免费、现代化、流畅、可测试、可移植的URL构建器和HTTP客户端库:Flurl。 项目介绍 Flurl是一个集现代性、流畅性、
我不确定其他与我的问题明显相似的问题是否归结为同一主题。 请考虑这段代码(为更清楚起见,为 head 部分提取了 CSS 代码): body { margin: 0;
我是一名学习 html/css 的学生,我在创建第一个网站时遇到了问题。我在配置页面时遇到了很多困难,因此它是流动的而不是固定的。我配置了一个框、图像和一些文本,因此它们在页面上是绝对的,但我无法使页
在我的游戏中,我已将角色设置为移动。它的设置方式是: if game_over_state == False: if event.type == pygame.KEYDOWN:
我一直在研究代码,但似乎无法让它工作。我用谷歌搜索,在这个网站上搜索了 13 页,但仍然找不到我要找的答案。 我希望视频以特定尺寸开始,然后随着我调整浏览器大小(从桌面到 iPad/iPhone)而缩
我已经从 sql server 2005 切换到 mysql,这并不是一个真正的问题。 我对 sql server 中存在的 (n)varchar 有一个小问题。通常我用过: mapping.Map(
我必须使用自定义 odbc 驱动程序。 我需要作为连接字符串传递的只是 DSN。 我如何使用(流畅)nhibernate 做到这一点? FluentNHibernate.Cfg.Db 仅提供带有 DS
我无法找到我们网站上动态显示的弹出窗口。最初该元素处于以下 html 状态: 使用jquery的show和hide,div显示5秒,稍后隐藏。 在我的 Selenium 脚本中,我尝试使用以下语句等
我有一个 two/three基于屏幕尺寸的列布局。 如果窗口大小大于 1000比我需要遵循 3 column其他布局我需要遵循 two column布局。 我是用JS实现的,但是代码很乱。现在我想用
我有一个 Flutter 应用程序,随着时间的推移和添加的功能越来越多,它变得越来越笨拙。因此,是否有一些实用程序可以使其像 60FPS 一样流畅? 我知道这里有一些官方指南:https://docs
我在如何实现 $(window).smartresize() 上纠结了几个小时使我的 div 流畅的功能。 我使用了这个 theme 中的 javascript但是当我尝试自己实现它时,我的 div
当我尝试通过 canvas.getContext('2d') 和 canvas.getContext('webgl') 将相同的 PNG 文件加载到 Canvas 中时,发现与canvas2d相比,w
我有一个所有实体的基类: public class BaseClass { public int SomeProperty {get; set;} } public class SomeEnt
我正在从事一个对时间相当敏感的元素。任务是制作一个微型网站,用户可以通过他们的智能手机访问该网站,在那里他们可以访问许多电影。他们会扫描二维码(我知道他们已经死了,我没有计划这次事件)。并登陆这个网站
我们正在使用Entity Framework 5.0。和数据库MySQL。当我们尝试迁移时间时出现异常。 could not be created because the principal key
快速问题:如何将传递给shiny.fluent::Text函数的文本设置为粗体?更广泛地说,如何将样式选项传递给此函数?。在函数的帮助页面中,它是这样写的。但我不明白如何使用这个变量参数。。我试着在不
我是一名优秀的程序员,十分优秀!