Search in sources :

Example 81 with LayoutParams

use of android.support.v7.app.ActionBar.LayoutParams in project smooth-app-bar-layout by henrytao-me.

the class SmoothAppBarLayout method onLayout.

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    super.onLayout(changed, l, t, r, b);
    int i = 0;
    for (int z = this.getChildCount(); i < z; ++i) {
        View child = this.getChildAt(i);
        LayoutParams childLp = (LayoutParams) child.getLayoutParams();
        Interpolator interpolator = childLp.getScrollInterpolator();
        if (interpolator != null) {
            mHaveChildWithInterpolator = true;
            break;
        }
    }
}
Also used : Interpolator(android.view.animation.Interpolator) View(android.view.View) NestedScrollView(android.support.v4.widget.NestedScrollView) RecyclerView(android.support.v7.widget.RecyclerView)

Example 82 with LayoutParams

use of android.support.v7.app.ActionBar.LayoutParams in project FastDev4Android by jiangqqlmj.

the class AdvanceDecoration method drawHDeraction.

/**
 * 绘制水平方向的分割线
 * @param c
 * @param parent
 */
private void drawHDeraction(Canvas c, RecyclerView parent) {
    int left = parent.getPaddingLeft();
    int right = parent.getWidth() - parent.getPaddingRight();
    int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        View child = parent.getChildAt(i);
        RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) child.getLayoutParams();
        int top = child.getBottom() + layoutParams.bottomMargin;
        int bottom = top + mDivider.getIntrinsicHeight();
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 83 with LayoutParams

use of android.support.v7.app.ActionBar.LayoutParams in project android-flowlayout by ApmeM.

the class FlowLayoutManager method onLayoutChildren.

@Override
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
    detachAndScrapAttachedViews(recycler);
    final int count = this.getItemCount();
    views.clear();
    lines.clear();
    for (int i = 0; i < count; i++) {
        View child = recycler.getViewForPosition(i);
        addView(child);
        measureChildWithMargins(child, 0, 0);
        final LayoutParams lp = (LayoutParams) child.getLayoutParams();
        ViewDefinition view = new ViewDefinition(this.config, child);
        view.setWidth(child.getMeasuredWidth());
        view.setHeight(child.getMeasuredHeight());
        view.setNewLine(lp.isNewLine());
        view.setGravity(lp.getGravity());
        view.setWeight(lp.getWeight());
        view.setMargins(lp.leftMargin, lp.topMargin, lp.rightMargin, lp.bottomMargin);
        views.add(view);
    }
    this.config.setMaxWidth(this.getWidth() - this.getPaddingRight() - this.getPaddingLeft());
    this.config.setMaxHeight(this.getHeight() - this.getPaddingTop() - this.getPaddingBottom());
    this.config.setWidthMode(View.MeasureSpec.EXACTLY);
    this.config.setHeightMode(View.MeasureSpec.EXACTLY);
    this.config.setCheckCanFit(true);
    CommonLogic.fillLines(views, lines, config);
    CommonLogic.calculateLinesAndChildPosition(lines);
    int contentLength = 0;
    final int linesCount = lines.size();
    for (int i = 0; i < linesCount; i++) {
        LineDefinition l = lines.get(i);
        contentLength = Math.max(contentLength, l.getLineLength());
    }
    LineDefinition currentLine = lines.get(lines.size() - 1);
    int contentThickness = currentLine.getLineStartThickness() + currentLine.getLineThickness();
    int realControlLength = CommonLogic.findSize(this.config.getLengthMode(), this.config.getMaxLength(), contentLength);
    int realControlThickness = CommonLogic.findSize(this.config.getThicknessMode(), this.config.getMaxThickness(), contentThickness);
    CommonLogic.applyGravityToLines(lines, realControlLength, realControlThickness, config);
    for (int i = 0; i < linesCount; i++) {
        LineDefinition line = lines.get(i);
        applyPositionsToViews(line);
    }
}
Also used : ViewDefinition(org.apmem.tools.layouts.logic.ViewDefinition) LineDefinition(org.apmem.tools.layouts.logic.LineDefinition) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 84 with LayoutParams

use of android.support.v7.app.ActionBar.LayoutParams in project Tangram-Android by alibaba.

the class LinearScrollView method bindHeaderView.

private void bindHeaderView(BaseCell cell) {
    if (cell.isValid()) {
        View header = getViewFromRecycler(cell);
        if (header != null) {
            header.setId(R.id.TANGRAM_BANNER_HEADER_ID);
            // 为了解决在 item 复用过程中,itemView 的 layoutParams 复用造成 layout 错误,这里要提供一个新的 layoutParams。
            LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
            lp.topMargin = cell.style.margin[Style.MARGIN_TOP_INDEX];
            lp.leftMargin = cell.style.margin[Style.MARGIN_LEFT_INDEX];
            lp.bottomMargin = cell.style.margin[Style.MARGIN_BOTTOM_INDEX];
            lp.rightMargin = cell.style.margin[Style.MARGIN_RIGHT_INDEX];
            addView(header, 0, lp);
        }
    }
}
Also used : View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayout(android.widget.LinearLayout)

Example 85 with LayoutParams

use of android.support.v7.app.ActionBar.LayoutParams in project Tangram-Android by alibaba.

the class BannerView method onLayout.

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    int measureWidth = mUltraViewPager.getMeasuredWidth();
    int measureHeight = mUltraViewPager.getMeasuredHeight();
    int indicatorHeight = mIndicator.getMeasuredHeight();
    int top = getPaddingTop();
    int left = getPaddingLeft();
    if (!mHeaderViewHolders.isEmpty()) {
        for (int i = 0, count = mHeaderViewHolders.size(); i < count; i++) {
            View header = mHeaderViewHolders.get(i).itemView;
            LayoutParams lp = (LayoutParams) header.getLayoutParams();
            header.layout(left + lp.leftMargin, top + lp.topMargin, header.getMeasuredWidth(), top + lp.topMargin + header.getMeasuredHeight());
            top += lp.topMargin + header.getMeasuredHeight() + lp.bottomMargin;
        }
    }
    mUltraViewPager.layout(left, top, measureWidth, top + measureHeight);
    top += measureHeight;
    if (isIndicatorOutside) {
        mIndicator.layout(left, top, measureWidth, top + measureHeight + indicatorHeight);
        top += indicatorHeight;
    } else {
        mIndicator.layout(left, top - indicatorHeight, measureWidth, top);
    }
    if (!mFooterViewHolders.isEmpty()) {
        for (int i = 0, count = mFooterViewHolders.size(); i < count; i++) {
            View footer = mFooterViewHolders.get(i).itemView;
            LayoutParams lp = (LayoutParams) footer.getLayoutParams();
            footer.layout(left + lp.leftMargin, top + lp.topMargin, footer.getMeasuredWidth(), top + lp.topMargin + footer.getMeasuredHeight());
            top += +lp.topMargin + footer.getMeasuredHeight() + lp.bottomMargin;
        }
    }
}
Also used : ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView)

Aggregations

View (android.view.View)140 RecyclerView (android.support.v7.widget.RecyclerView)127 TextView (android.widget.TextView)46 ImageView (android.widget.ImageView)38 ViewGroup (android.view.ViewGroup)33 LinearLayout (android.widget.LinearLayout)27 LayoutParams (android.support.v7.widget.RecyclerView.LayoutParams)17 Paint (android.graphics.Paint)15 StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)15 FrameLayout (android.widget.FrameLayout)15 BindView (butterknife.BindView)12 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)11 Toolbar (android.support.v7.widget.Toolbar)11 Rect (android.graphics.Rect)9 EditText (android.widget.EditText)9 OrientationHelperEx (com.alibaba.android.vlayout.OrientationHelperEx)9 AdapterView (android.widget.AdapterView)8 RelativeLayout (android.widget.RelativeLayout)8 VirtualLayoutManager (com.alibaba.android.vlayout.VirtualLayoutManager)8 SuppressLint (android.annotation.SuppressLint)7