android.widget.AdapterView#LayoutParams ( )源码实例Demo

下面列出了android.widget.AdapterView#LayoutParams ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: UltimateAndroid   文件: SpanVariableGridView.java
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;
    }
 
源代码2 项目: UltimateAndroid   文件: SpanVariableGridView.java
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;
    }
 
源代码3 项目: XMouse   文件: SpanVariableGridView.java
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;
	}
 
源代码4 项目: UltimateAndroid   文件: SpanVariableGridView.java
public LayoutParams(AdapterView.LayoutParams other) {
    super(other);

    setupWidthAndHeight();

}
 
源代码5 项目: UltimateAndroid   文件: SpanVariableGridView.java
public LayoutParams(AdapterView.LayoutParams other) {
    super(other);

    setupWidthAndHeight();

}
 
源代码6 项目: XMouse   文件: SpanVariableGridView.java
public LayoutParams(AdapterView.LayoutParams other) {
	super(other);

	setupWidthAndHeight();

}