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;
}
}
}
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);
}
}
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);
}
}
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);
}
}
}
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;
}
}
}
Aggregations