use of android.support.v7.app.ActionBar.LayoutParams in project weiui by kuaifan.
the class RecycleViewDivider method drawHorizontal.
// 绘制横向 item 分割线
private void drawHorizontal(Canvas canvas, RecyclerView parent) {
final int left = parent.getPaddingLeft();
final int right = parent.getMeasuredWidth() - parent.getPaddingRight();
final int childSize = parent.getChildCount();
for (int i = 0; i < childSize; i++) {
final View child = parent.getChildAt(i);
RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) child.getLayoutParams();
final int top = child.getBottom() + layoutParams.bottomMargin;
final int bottom = top + mDividerHeight;
if (mDivider != null) {
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(canvas);
}
if (mPaint != null) {
canvas.drawRect(left, top, right, bottom, mPaint);
}
}
}
use of android.support.v7.app.ActionBar.LayoutParams in project weiui by kuaifan.
the class RecycleViewDivider method drawVertical.
// 绘制纵向 item 分割线
private void drawVertical(Canvas canvas, RecyclerView parent) {
final int top = parent.getPaddingTop();
final int bottom = parent.getMeasuredHeight() - parent.getPaddingBottom();
final int childSize = parent.getChildCount();
for (int i = 0; i < childSize; i++) {
final View child = parent.getChildAt(i);
RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) child.getLayoutParams();
final int left = child.getRight() + layoutParams.rightMargin;
final int right = left + mDividerHeight;
if (mDivider != null) {
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(canvas);
}
if (mPaint != null) {
canvas.drawRect(left, top, right, bottom, mPaint);
}
}
}
use of android.support.v7.app.ActionBar.LayoutParams in project PageRecyclerView by ckrgithub.
the class PageView method initView.
private void initView() {
View inflate;
if (orientation == 0) {
inflate = View.inflate(getContext(), R.layout.horizontal_page_view, null);
} else {
inflate = View.inflate(getContext(), R.layout.vertical_page_view, null);
}
// <editor-fold desc="init recyclerView">
recyclerView = (PageRecyclerView) inflate.findViewById(R.id.recyclerView);
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) recyclerView.getLayoutParams();
if (orientation == OnPageDataListener.HORIZONTAL) {
if (!overlapStyle) {
params.bottomMargin = indicatorContainerHeight;
}
} else if (orientation == OnPageDataListener.VERTICAL) {
if (!overlapStyle) {
params.leftMargin = indicatorContainerWidth;
}
}
recyclerView.setLayoutParams(params);
recyclerView.setOrientation(orientation);
recyclerView.setLooping(isLooping);
recyclerView.addOnPageChangeListener(this);
if (pageBackground != null) {
if (Build.VERSION_CODES.JELLY_BEAN <= Build.VERSION.SDK_INT) {
recyclerView.setBackground(pageBackground);
} else {
recyclerView.setBackgroundDrawable(pageBackground);
}
pageBackground = null;
}
// </editor-fold>
View indicatorContainer = inflate.findViewById(R.id.indicatorContainer);
if (hideIndicator) {
indicatorContainer.setVisibility(GONE);
} else {
// <editor-fold desc="init indicatorContainer"
params = (FrameLayout.LayoutParams) indicatorContainer.getLayoutParams();
if (orientation == OnPageDataListener.HORIZONTAL) {
params.height = indicatorContainerHeight;
} else if (orientation == OnPageDataListener.VERTICAL) {
params.width = indicatorContainerWidth;
}
indicatorContainer.setLayoutParams(params);
if (indicatorContainerBackground != null) {
if (Build.VERSION_CODES.JELLY_BEAN <= Build.VERSION.SDK_INT) {
indicatorContainer.setBackground(indicatorContainerBackground);
} else {
indicatorContainer.setBackgroundDrawable(indicatorContainerBackground);
}
indicatorContainerBackground = null;
}
// </editor-fold>
layoutIndicatorGroup(inflate);
// <editor-fold desc="init moveIndicator"
moveIndicator = inflate.findViewById(R.id.moveIndicator);
LayoutParams layoutParams = (LayoutParams) moveIndicator.getLayoutParams();
layoutParams.width = selectedIndicatorDiameter;
layoutParams.height = selectedIndicatorDiameter;
moveIndicator.setLayoutParams(layoutParams);
if (selectedIndicatorDrawable == null) {
drawViewBackground(moveIndicator, selectedIndicatorColor, selectedIndicatorDiameter, selectedIndicatorDiameter, selectedIndicatorDiameter, selectedIndicatorDiameter, 0, 0);
} else {
if (Build.VERSION_CODES.JELLY_BEAN <= Build.VERSION.SDK_INT) {
moveIndicator.setBackground(selectedIndicatorDrawable);
} else {
moveIndicator.setBackgroundDrawable(selectedIndicatorDrawable);
}
selectedIndicatorDrawable = null;
}
// </editor-fold>
}
addView(inflate);
}
use of android.support.v7.app.ActionBar.LayoutParams in project PageRecyclerView by ckrgithub.
the class PageView method layoutIndicatorGroup.
private void layoutIndicatorGroup(View inflate) {
indicatorGroup = (LinearLayout) inflate.findViewById(R.id.indicatorGroup);
View view = inflate.findViewById(R.id.relativeLayout);
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
layoutParams.setMargins(indicatorGroupMarginLeft, indicatorGroupMarginTop, indicatorGroupMarginRight, indicatorGroupMarginBottom);
final int verticalGravity = indicatorGroupAlignment & Gravity.VERTICAL_GRAVITY_MASK;
int horizontalGravity = indicatorGroupAlignment & Gravity.HORIZONTAL_GRAVITY_MASK;
Logd(TAG, "initView: indicatorGroupAlignment:" + indicatorGroupAlignment + ",verticalGravity:" + verticalGravity + ",horizontalGravity:" + horizontalGravity);
switch(horizontalGravity) {
case Gravity.CENTER_HORIZONTAL:
layoutParams.addRule(CENTER_HORIZONTAL);
break;
case Gravity.RIGHT:
// layoutParams.addRule(ALIGN_PARENT_RIGHT);.tell me why it doesn't work ?
layoutParams.addRule(ALIGN_PARENT_END);
case Gravity.LEFT:
default:
layoutParams.addRule(ALIGN_PARENT_LEFT);
break;
}
switch(verticalGravity) {
case Gravity.CENTER_VERTICAL:
layoutParams.addRule(CENTER_VERTICAL);
break;
case Gravity.BOTTOM:
layoutParams.addRule(ALIGN_PARENT_BOTTOM);
break;
case Gravity.TOP:
default:
layoutParams.addRule(ALIGN_PARENT_TOP);
break;
}
view.setLayoutParams(layoutParams);
}
use of android.support.v7.app.ActionBar.LayoutParams in project BaseProject by feer921.
the class BaseQuickAdapter method addFooterView.
/**
* Add footer view to mFooterLayout and set footer view position in mFooterLayout.
* When index = -1 or index >= child count in mFooterLayout,
* the effect of this method is the same as that of {@link #addFooterView(View)}.
*
* @param footer
* @param index the position in mFooterLayout of this footer.
* When index = -1 or index >= child count in mFooterLayout,
* the effect of this method is the same as that of {@link #addFooterView(View)}.
*/
public int addFooterView(View footer, int index, int orientation) {
if (mFooterLayout == null) {
mFooterLayout = new LinearLayout(footer.getContext());
if (orientation == LinearLayout.VERTICAL) {
mFooterLayout.setOrientation(LinearLayout.VERTICAL);
mFooterLayout.setLayoutParams(new LayoutParams(MATCH_PARENT, WRAP_CONTENT));
} else {
mFooterLayout.setOrientation(LinearLayout.HORIZONTAL);
mFooterLayout.setLayoutParams(new LayoutParams(WRAP_CONTENT, MATCH_PARENT));
}
}
final int childCount = mFooterLayout.getChildCount();
if (index < 0 || index > childCount) {
index = childCount;
}
mFooterLayout.addView(footer, index);
if (mFooterLayout.getChildCount() == 1) {
int position = getFooterViewPosition();
if (position != -1) {
notifyItemInserted(position);
}
}
return index;
}
Aggregations