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?
精彩评论