Example usage for android.widget HorizontalScrollView getHeight

List of usage examples for android.widget HorizontalScrollView getHeight

Introduction

In this page you can find the example usage for android.widget HorizontalScrollView getHeight.

Prototype

@ViewDebug.ExportedProperty(category = "layout")
public final int getHeight() 

Source Link

Document

Return the height of your view.

Usage

From source file:org.catrobat.paintroid.ui.BottomBar.java

private void scrollToSelectedTool(ToolType toolType) {
    int orientation = mMainActivity.getResources().getConfiguration().orientation;
    View toolButton = getToolButtonByToolType(toolType);

    if (orientation == Configuration.ORIENTATION_PORTRAIT) {
        HorizontalScrollView scrollView = (HorizontalScrollView) mMainActivity
                .findViewById(R.id.bottom_bar_scroll_view);
        scrollView.smoothScrollTo(/*from  w w w  .j  av  a2 s  . c  o m*/
                (int) (toolButton.getX() - scrollView.getWidth() / 2.0f + toolButton.getWidth() / 2.0f),
                (int) toolButton.getY());
    } else if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
        ScrollView scrollView = (ScrollView) mMainActivity.findViewById(R.id.bottom_bar_landscape_scroll_view);
        scrollView.smoothScrollTo((int) (toolButton.getX()),
                (int) (toolButton.getY() - scrollView.getHeight() / 2.0f + toolButton.getHeight() / 2.0f));
    }
}

From source file:org.catrobat.paintroid.test.integration.BaseIntegrationTestClass.java

private void scrollToolBarToLeft() {
    HorizontalScrollView scrollView = (HorizontalScrollView) mSolo.getView(R.id.bottom_bar_scroll_view);
    int[] screenLocation = { 0, 0 };
    scrollView.getLocationOnScreen(screenLocation);
    int getAwayFromNavigationDrawer = 60;
    float fromX = screenLocation[0] + getAwayFromNavigationDrawer;
    float toX = screenLocation[0] + scrollView.getWidth();
    float yPos = screenLocation[1] + (scrollView.getHeight() / 2.0f);

    mSolo.drag(fromX, toX, yPos, yPos, 1);
}