Example usage for android.widget ScrollView getMeasuredHeight

List of usage examples for android.widget ScrollView getMeasuredHeight

Introduction

In this page you can find the example usage for android.widget ScrollView getMeasuredHeight.

Prototype

public final int getMeasuredHeight() 

Source Link

Document

Like #getMeasuredHeightAndState() , but only returns the raw height component (that is the result is masked by #MEASURED_SIZE_MASK ).

Usage

From source file:cn.bingoogolapple.refreshlayout.util.BGARefreshScrollingUtil.java

public static boolean isScrollViewToBottom(ScrollView scrollView) {
    if (scrollView != null) {
        int scrollContentHeight = scrollView.getScrollY() + scrollView.getMeasuredHeight()
                - scrollView.getPaddingTop() - scrollView.getPaddingBottom();
        int realContentHeight = scrollView.getChildAt(0).getMeasuredHeight();
        if (scrollContentHeight == realContentHeight) {
            return true;
        }//w  ww. ja v  a 2  s .  co  m
    }
    return false;
}

From source file:com.lanma.customviewproject.utils.ScrollingUtil.java

/**
 * ScrollView?/*  ww w.  ja  v a 2  s  .c  o m*/
 */
public static boolean isScrollViewToBottom(ScrollView scrollView) {
    if (scrollView != null) {
        int scrollContentHeight = scrollView.getScrollY() + scrollView.getMeasuredHeight()
                - scrollView.getPaddingTop() - scrollView.getPaddingBottom();
        int realContentHeight = scrollView.getChildAt(0).getMeasuredHeight();
        if (scrollContentHeight == realContentHeight) {
            return true;
        }
    }
    return false;
}

From source file:com.mobicage.rogerthat.plugins.messaging.widgets.AdvancedOrderWidget.java

private void setDetailScrollViewHeight() {
    final Point displaySize = UIUtils.getDisplaySize(mActivity);
    final TextView nameLbl = (TextView) mDetailDialog.findViewById(R.id.name);
    final TextView priceLbl = (TextView) mDetailDialog.findViewById(R.id.price);
    final ScrollView scrollView = (ScrollView) mDetailDialog.findViewById(R.id.scroll_view);
    final LinearLayout valueContainer = (LinearLayout) mDetailDialog.findViewById(R.id.value_container);
    final Button dismissBtn = (Button) mDetailDialog.findViewById(R.id.dismiss);
    int maxPopupHeight = (int) Math.floor(displaySize.y * 0.75);

    int desiredWidth = MeasureSpec.makeMeasureSpec(nameLbl.getWidth(), MeasureSpec.AT_MOST);

    nameLbl.measure(desiredWidth, 0);/*from w w w.ja  v  a  2  s.c  om*/
    int nameLblHeight = nameLbl.getMeasuredHeight();
    int priceLblHeight = 0;
    if (priceLbl.getVisibility() == View.VISIBLE) {
        priceLbl.measure(desiredWidth, 0);
        priceLblHeight = priceLbl.getMeasuredHeight();
    }
    valueContainer.measure(desiredWidth, 0);
    int valueContainerHeight = valueContainer.getMeasuredHeight();
    dismissBtn.measure(desiredWidth, 0);
    int dismissBtnHeight = dismissBtn.getMeasuredHeight();

    int maxScrollViewHeight = maxPopupHeight - nameLblHeight - priceLblHeight - valueContainerHeight
            - dismissBtnHeight;

    ViewGroup.LayoutParams params = scrollView.getLayoutParams();
    scrollView.measure(desiredWidth, 0);
    params.height = scrollView.getMeasuredHeight();
    if (maxScrollViewHeight > 0 && params.height > maxScrollViewHeight) {
        params.height = maxScrollViewHeight;
    }
    scrollView.setLayoutParams(params);
    scrollView.requestLayout();
}