Java Code Examples for android.support.v7.widget.RecyclerView#MarginLayoutParams

The following examples show how to use android.support.v7.widget.RecyclerView#MarginLayoutParams . 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
Source File: GridLayoutManager.java    From TvRecyclerView with Apache License 2.0 5 votes vote down vote up
private int getViewMin(View v) {
    final RecyclerView.MarginLayoutParams lp = (RecyclerView.MarginLayoutParams)v.getLayoutParams();
    if (mOrientation == HORIZONTAL) {
        return getDecoratedLeft(v) - lp.leftMargin;
    } else {
        return getDecoratedTop(v) - lp.topMargin;
    }
}
 
Example 2
Source File: GridLayoutManager.java    From TvRecyclerView with Apache License 2.0 5 votes vote down vote up
private int getViewMax(View v) {
    final RecyclerView.MarginLayoutParams lp = (RecyclerView.MarginLayoutParams) v.getLayoutParams();
    if (mOrientation == HORIZONTAL) {
        return getDecoratedRight(v) + lp.rightMargin;
    } else {
        return getDecoratedBottom(v) + lp.bottomMargin;
    }
}
 
Example 3
Source File: GridLayoutManager.java    From TvRecyclerView with Apache License 2.0 4 votes vote down vote up
private int getMeasurementHorizontal(View view) {
    final RecyclerView.MarginLayoutParams params = (RecyclerView.LayoutParams)
            view.getLayoutParams();
    return  view.getMeasuredWidth() + params.leftMargin
            + params.rightMargin;
}
 
Example 4
Source File: GridLayoutManager.java    From TvRecyclerView with Apache License 2.0 4 votes vote down vote up
private int getMeasurementVertical(View view) {
    final RecyclerView.MarginLayoutParams params = (RecyclerView.LayoutParams)
            view.getLayoutParams();
    return view.getMeasuredHeight() + params.topMargin
            + params.bottomMargin;
}
 
Example 5
Source File: GridLayoutManager.java    From TvRecyclerView with Apache License 2.0 4 votes vote down vote up
private int getDecoratedMeasurementHorizontal(View view) {
    final RecyclerView.MarginLayoutParams params = (RecyclerView.LayoutParams)
            view.getLayoutParams();
    return getDecoratedMeasuredWidth(view) + params.leftMargin
            + params.rightMargin;
}
 
Example 6
Source File: GridLayoutManager.java    From TvRecyclerView with Apache License 2.0 4 votes vote down vote up
private int getDecoratedMeasurementVertical(View view) {
    final RecyclerView.MarginLayoutParams params = (RecyclerView.LayoutParams)
            view.getLayoutParams();
    return getDecoratedMeasuredHeight(view) + params.topMargin
            + params.bottomMargin;
}
 
Example 7
Source File: GridLayoutManager.java    From TvRecyclerView with Apache License 2.0 4 votes vote down vote up
private int getChildHorizontalPadding(View child) {
    final RecyclerView.MarginLayoutParams params = (RecyclerView.LayoutParams)
            child.getLayoutParams();
    return getDecoratedMeasuredWidth(child) + params.leftMargin
            + params.rightMargin - child.getMeasuredWidth() + mAdapter.getColumnSpacing();
}
 
Example 8
Source File: GridLayoutManager.java    From TvRecyclerView with Apache License 2.0 4 votes vote down vote up
private int getChildVerticalPadding(View child) {
    final RecyclerView.MarginLayoutParams params = (RecyclerView.LayoutParams)
            child.getLayoutParams();
    return getDecoratedMeasuredHeight(child) + params.topMargin
            + params.bottomMargin - child.getMeasuredHeight() + mAdapter.getRowSpacing();
}