当 TextView 重绘时,如何阻止 Android SlidingDrawer 闪烁
我有一个 Android 活动,其中包括一些 TextView 和一个 SlidingDrawer。只要没有任何内容调用 TextView 上的 setText,滑动抽屉就会流畅地动画。这对我来说是一个破坏者,因为在我的活动中,可运行的导致 setText 每秒被调用几次,在我滑动 SlidingDrawer 打开时导致一些非常讨厌的闪烁。
关于如何停止这种闪烁并仍然让我的 TextViews 按应有的方式更新有什么想法吗?
这是导致闪烁的代码,特别是下面的两行 setText 行,在我的 Activity.OnCreate() 方法中调用。
mMainUIHandler = new Handler() {
public void handleMessage(Message msg) {
String[] positions = msg.obj;
xCoords.setText(positions[0]);
yCoords.setText(positions[1]);
}
}
更新:我还没能解决这个问题,但我已经解决了。我在 SlidingDrawer.isMoving() 时停止更新。这目前有效,但没有回答问题。
I have an Android activity that includes some TextViews and a SlidingDrawer. The sliding drawer animates smoothly as long as nothing calls setText on the TextViews. This is a dealbreaker for me, because in my activity, a runnable causes setText to be called several times per second, causing some pretty nasty flicker while I am Sliding the SlidingDrawer open.
Any ideas on how to stop this flickering and still have my TextViews update the way they should?
Here is the code that is causing the flicker, specifically the two setText lines below, called in my Activity.OnCreate() method.
mMainUIHandler = new Handler() {
public void handleMessage(Message msg) {
String[] positions = msg.obj;
xCoords.setText(positions[0]);
yCoords.setText(positions[1]);
}
}
Update: I haven't been able to solve this yet, but I have worked around it. I stop the updates while the SlidingDrawer.isMoving(). This works for now, but doesn't answer the question.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论