当我从同一ListView行更新另一个TextView时,TextView滚动正在重置 [英] TextView scrolling is resetting when I update a different TextView from the same ListView row

查看:66
本文介绍了当我从同一ListView行更新另一个TextView时,TextView滚动正在重置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个列表视图,对于一个特定的项目,我每秒刷新一次剩余时间. 它工作正常,但是我有一个小错误. 每当我打电话

I have a listview and for a specific item I'm refreshing the remaining time every second. It works fine, but I'm having a small bug. Whenever I call

duration.setText(newRemainingValue);

要更新该值,将影响同一行中的另一个textView. 这另一个textVewi显示一个模糊的文本

to update the value, another textView from the same row is impacted. This other textVewi displays a scolling text

title.setSelected(true);
title.setEllipsize(TruncateAt.MARQUEE);

,每当我更改第一个textView值时,第二个将重置滚动并从头开始滚动.看来只有在ListView中执行此操作时才会出现此问题

and whenever I change the 1st textView value, the second one resets the scrolling and starts scrolling from the beginning. It looks like this issue is only present when I do this in a ListView

有什么办法解决这个问题吗?

Any idea how to fix this ?

推荐答案

听起来好像textviews设置为wrap_content.每当更改文本时,这都会触发布局传递.尝试使用match_parent或将width和height设置为固定值,以免更改文本不会触发布局通过

It sounds like the textviews are set to wrap_content. That will trigger a layout pass whenever the text is changed. Try using match_parent or setting the width and height to a fixed value, so that changing the text will not trigger a layout pass

这篇关于当我从同一ListView行更新另一个TextView时,TextView滚动正在重置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆