Source:
private void startBottomBarAnimation() { final HorizontalScrollView horizontalScrollView = (HorizontalScrollView) mMainActivity.findViewById(R.id.bottom_bar_scroll_view); final ScrollView verticalScrollView = (ScrollView) mMainActivity.findViewById(R.id.bottom_bar_landscape_scroll_view); final int animationDuration = 1000; int orientation = mMainActivity.getResources().getConfiguration().orientation; if (orientation == Configuration.ORIENTATION_PORTRAIT) { horizontalScrollView.post(new Runnable() { public void run() { int ScrollToX = (int) (getToolButtonByToolType(mCurrentTool.getToolType()).getX() - horizontalScrollView.getWidth() / 2.0f + mMainActivity.getResources().getDimension(R.dimen.bottom_bar_button_width) / 2.0f); int ScrollFromX = PaintroidApplication.isRTL ? horizontalScrollView.getChildAt(0).getLeft() : horizontalScrollView.getChildAt(0).getRight(); horizontalScrollView.setScrollX(ScrollFromX); ObjectAnimator.ofInt(horizontalScrollView, "scrollX", ScrollToX).setDuration(animationDuration).start(); } }); } else if (orientation == Configuration.ORIENTATION_LANDSCAPE) { verticalScrollView.post(new Runnable() { public void run() { int ScrollToY = (int) (getToolButtonByToolType(mCurrentTool.getToolType()).getY() - verticalScrollView.getHeight() / 2.0f + mMainActivity.getResources().getDimension(R.dimen.bottom_bar_landscape_button_height) / 2.0f); int ScrollFromY = verticalScrollView.getChildAt(0).getBottom(); verticalScrollView.setScrollY(ScrollFromY); ObjectAnimator.ofInt(verticalScrollView, "scrollY", ScrollToY).setDuration(animationDuration).start(); } }); } delayedAnimateSelectedTool(animationDuration); }

Target:
private void startBottomBarAnimation() { final HorizontalScrollView horizontalScrollView = (HorizontalScrollView) mMainActivity.findViewById(R.id.bottom_bar_scroll_view); final ScrollView verticalScrollView = (ScrollView) mMainActivity.findViewById(R.id.bottom_bar_landscape_scroll_view); final int animationDuration = 1000; int orientation = mMainActivity.getResources().getConfiguration().orientation; if (orientation == Configuration.ORIENTATION_PORTRAIT) { horizontalScrollView.post(new Runnable() { public void run() { int scrollToX = (int) (getToolButtonByToolType(mCurrentTool.getToolType()).getX() - horizontalScrollView.getWidth() / 2.0f + mMainActivity.getResources().getDimension(R.dimen.bottom_bar_button_width) / 2.0f); int scrollFromX = PaintroidApplication.isRTL ? horizontalScrollView.getChildAt(0).getLeft() : horizontalScrollView.getChildAt(0).getRight(); horizontalScrollView.setScrollX(scrollFromX); ObjectAnimator.ofInt(horizontalScrollView, "scrollX", scrollToX).setDuration(animationDuration).start(); } }); } else if (orientation == Configuration.ORIENTATION_LANDSCAPE) { verticalScrollView.post(new Runnable() { public void run() { int scrollToY = (int) (getToolButtonByToolType(mCurrentTool.getToolType()).getY() - verticalScrollView.getHeight() / 2.0f + mMainActivity.getResources().getDimension(R.dimen.bottom_bar_landscape_button_height) / 2.0f); int scrollFromY = verticalScrollView.getChildAt(0).getBottom(); verticalScrollView.setScrollY(scrollFromY); ObjectAnimator.ofInt(verticalScrollView, "scrollY", scrollToY).setDuration(animationDuration).start(); } }); } delayedAnimateSelectedTool(animationDuration); }