开发者

Why does scrolling a view at activity start only work in a runnable?

Why does doing

HorizontalScrollView hsv = (HorizontalScrollView) findViewById(R.id.buttons);
if (null != hsv) hsv.scrollBy(iLengthToScroll, 0);              

in onResume do nothing, but

Handler mHandler = new Handler();
Runnable scroll = new Runnable()
{
  @Override
  public void run()
  {
 开发者_运维百科   HorizontalScrollView hsv = (HorizontalScrollView) findViewById(R.id.buttons);
    if (null != hsv) hsv.scrollBy(iLengthToScroll, 0);              
  }
};
mHandler.post(scroll);

do the scrolling? Handler.post adds the runnable to the UI thread, but onResume is already in the UI thread, isn't it?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜