TextView scrolling is resetting when I update a different TextView from the same ListView row

隐身守侯 提交于 2019-12-19 09:03:06

问题


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);

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);

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 ?


回答1:


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



来源:https://stackoverflow.com/questions/28305745/textview-scrolling-is-resetting-when-i-update-a-different-textview-from-the-same

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!