当使用scrollTo ListView控件不刷新,但是,当手动滚动它刷新控件、scrollTo、ListView

由网友(Slacker(懒鬼))分享简介:我有不同的颜色为在ListView不同的线路,通过设置的文本框根据行数的()适配器中getView()的颜色。现在,当我手动滚动的ListView向上正确的颜色显示在底线是得到揭示。但是当我使用scrollTo,这不列入发生,揭示了所有行具有相同的颜色(他们没有更新)。I have different colors...

我有不同的颜色为在ListView不同的线路,通过设置的文本框根据行数的()适配器中getView()的颜色。现在,当我手动滚动的ListView向上正确的颜色显示在底线是得到揭示。但是当我使用scrollTo,这不列入发生,揭示了所有行具有相同的颜色(他们没有更新)。

I have different colors for different lines in the ListView, by setting the color of textbox depending on the line number (in getView() of Adapter). Now when I manually scroll the ListView upwards the correct color is displayed in the bottom lines that get revealed. But when I use scrollTo, this doesnot happen, all lines revealed have the same color (they are not updated).

有没有人遇到这个问题?这似乎令人费解!

Has anybody faced this issue? This seems baffling!

推荐答案

的ListView#scrollTo 不滚动列表内容。 (这是一个标准的查看方法,而不是具体名单都:它滚动的ListView视图本身)

ListView#scrollTo doesn't scroll the list contents. (It's a standard View method, and not specific to lists at all: it scrolls the ListView view itself.)

相反,尝试使用的ListView#setSelectionFromTop(0,int y)对滚动。

API 19+有一个的ListView#scrollListBy(int y)对方法,如果你要编程的奇巧了起来。

API 19+ has a ListView#scrollListBy(int y) method if you're programming for KitKat and up.

阅读全文

相关推荐

最新文章