Java Code Examples for android.widget.AdapterView#LayoutParams

The following examples show how to use android.widget.AdapterView#LayoutParams . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
protected int measureChildrens(final boolean justMeasure) {

        int row = 0;
        int col = 0;
        int rowHeight = 0;
        int spansFilled = 0;
        int fullHeight = mItemMargin;

        for (int position = 0; position < mAdapter.getCount(); position++) {
            View childView = getChildAt(position);

            if (childView == null) {
                childView = mAdapter.getView(position, null, this);

                LayoutParams params = (LayoutParams) childView.getLayoutParams();
                if (params == null) {

                    params = new LayoutParams(new AdapterView.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
                }

                if (!justMeasure) {
                    addViewInLayout(childView, NOT_DEFINED_VALUE, params);
                }
            }

            final LayoutParams lp = (LayoutParams) childView.getLayoutParams();

            measureChildren(childView, lp.width, lp.height);

            lp.position = position;
            spansFilled += lp.span;

            while (true) {

                if (spansFilled <= mColCount) {

                    lp.row = row;
                    lp.column = lp.span == mColCount ? LayoutParams.ALL_COLUMNS : col;
                    col = spansFilled;

                    if (justMeasure) {
                        fireCalculateChildrenPositionEvent(childView, lp.position, lp.row, lp.column);
                    } else {
                        childView.setLayoutParams(lp);
                    }

                    rowHeight = Math.max(rowHeight, mItemMargin + childView.getMeasuredHeight());
                }

                if (spansFilled >= mColCount) {

                    fullHeight += rowHeight;
                    row++;

                    col = 0;
                    rowHeight = 0;

                    if (spansFilled != mColCount) {

                        spansFilled = lp.span;
                        continue;
                    }

                    spansFilled = 0;
                }

                break;
            }
        }

        fullHeight += rowHeight;
        return fullHeight;
    }
 
Example 2
protected int measureChildrens(final boolean justMeasure) {

        int row = 0;
        int col = 0;
        int rowHeight = 0;
        int spansFilled = 0;
        int fullHeight = mItemMargin;

        for (int position = 0; position < mAdapter.getCount(); position++) {
            View childView = getChildAt(position);

            if (childView == null) {
                childView = mAdapter.getView(position, null, this);

                LayoutParams params = (LayoutParams) childView.getLayoutParams();
                if (params == null) {

                    params = new LayoutParams(new AdapterView.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
                }

                if (!justMeasure) {
                    addViewInLayout(childView, NOT_DEFINED_VALUE, params);
                }
            }

            final LayoutParams lp = (LayoutParams) childView.getLayoutParams();

            measureChildren(childView, lp.width, lp.height);

            lp.position = position;
            spansFilled += lp.span;

            while (true) {

                if (spansFilled <= mColCount) {

                    lp.row = row;
                    lp.column = lp.span == mColCount ? LayoutParams.ALL_COLUMNS : col;
                    col = spansFilled;

                    if (justMeasure) {
                        fireCalculateChildrenPositionEvent(childView, lp.position, lp.row, lp.column);
                    } else {
                        childView.setLayoutParams(lp);
                    }

                    rowHeight = Math.max(rowHeight, mItemMargin + childView.getMeasuredHeight());
                }

                if (spansFilled >= mColCount) {

                    fullHeight += rowHeight;
                    row++;

                    col = 0;
                    rowHeight = 0;

                    if (spansFilled != mColCount) {

                        spansFilled = lp.span;
                        continue;
                    }

                    spansFilled = 0;
                }

                break;
            }
        }

        fullHeight += rowHeight;
        return fullHeight;
    }
 
Example 3
Source Project: XMouse   File: SpanVariableGridView.java    License: MIT License 4 votes vote down vote up
private int measureChildrens(final boolean justMeasure) {

		int row = 0;
		int col = 0;
		int rowHeight = 0;
		int spansFilled = 0;
		int fullHeight = mItemMargin;

		for (int position = 0; position < mAdapter.getCount(); position++) {
			View childView = getChildAt(position);

			if (childView == null) {
				childView = mAdapter.getView(position, null, this);

				LayoutParams params = (LayoutParams) childView.getLayoutParams();
				if (params == null) {

					params = new LayoutParams(new AdapterView.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
				}

				if (!justMeasure) {
					addViewInLayout(childView, NOT_DEFINED_VALUE, params);
				}
			}

			final LayoutParams lp = (LayoutParams) childView.getLayoutParams();

			measureChildren(childView, lp.width, lp.height);

			lp.position = position;
			spansFilled += lp.span;

			while (true) {

				if (spansFilled <= mColCount) {

					lp.row = row;
					lp.column = lp.span == mColCount ? LayoutParams.ALL_COLUMNS : col;
					col = spansFilled;

					if (justMeasure) {
						fireCalculateChildrenPositionEvent(childView, lp.position, lp.row, lp.column);
					} else {
						childView.setLayoutParams(lp);
					}

					rowHeight = Math.max(rowHeight, mItemMargin + childView.getMeasuredHeight());
				}

				if (spansFilled >= mColCount) {

					fullHeight += rowHeight;
					row++;

					col = 0;
					rowHeight = 0;

					if (spansFilled != mColCount) {

						spansFilled = lp.span;
						continue;
					}

					spansFilled = 0;
				}

				break;
			}
		}

		fullHeight += rowHeight;
		return fullHeight;
	}
 
Example 4
public LayoutParams(AdapterView.LayoutParams other) {
    super(other);

    setupWidthAndHeight();

}
 
Example 5
public LayoutParams(AdapterView.LayoutParams other) {
    super(other);

    setupWidthAndHeight();

}
 
Example 6
Source Project: XMouse   File: SpanVariableGridView.java    License: MIT License 2 votes vote down vote up
public LayoutParams(AdapterView.LayoutParams other) {
	super(other);

	setupWidthAndHeight();

}