Java 类android.support.v7.widget.StaggeredGridLayoutManager.LayoutParams 实例源码

项目:joy-library    文件:RecyclerAdapter.java   
@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {

    if (isItem(position)) {

        mAdapter.onBindViewHolder(holder, position - getHeadersCount());
    } else {

        if (mLayoutManager != null && mLayoutManager instanceof StaggeredGridLayoutManager) {

            LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
            params.setFullSpan(true);
            holder.itemView.setLayoutParams(params);
        }
    }
}
项目:boohee_v5.6    文件:RcvAdapterWrapper.java   
private void setFullSpan(View view, LayoutManager layoutManager) {
    int itemHeight = view.getLayoutParams() != null ? view.getLayoutParams().height : -2;
    if (layoutManager instanceof StaggeredGridLayoutManager) {
        LayoutParams layoutParams = new LayoutParams(-1, itemHeight);
        layoutParams.setFullSpan(true);
        view.setLayoutParams(layoutParams);
    } else if (layoutManager instanceof GridLayoutManager) {
        view.setLayoutParams(new ViewGroup.LayoutParams(-1, itemHeight));
    }
    notifyDataSetChanged();
}
项目:core-ui    文件:RecyclerAdapter.java   
@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {
    if (isItem(position)) {
        mAdapter.onBindViewHolder(holder, position - getHeadersCount());
    } else {
        if (mLayoutManager != null && mLayoutManager instanceof StaggeredGridLayoutManager) {
            LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
            params.setFullSpan(true);
            holder.itemView.setLayoutParams(params);
        }
    }
}