Android View animation and AsyncTask
I have my horizontal main menu and I want it to move the clicked item to the center. On click event inside HorizontalScrollView I have something like this
int screenWidth = getWindowManager().getDefaultDisplay().getWidth();
final int pos = v.getLeft() - (screenWidth/2 - v.getWidth()/2);
final HorizontalScrollView hsv = (HorizontalScrollView)findViewById(R.id.my_scrollview);
hsv.setSmoothScrollingEnabled(true);
hsv.smoothScrollTo(pos, 0);
//my asyncTask to load list of headlines
new LoadLocalHeadlinesTask().execute();
Everything works fine except that onPostEx开发者_如何转开发ecute() method (which updates listView with new items) is called before the 'smooth' animation of the HorizontalScrollView is finished. Because of that the animation is not smooth at all.
Could you help me with this, maybe you know different approach?
Thanks
精彩评论