当前位置: 首页>>代码示例>>Java>>正文


Java GridSLM.LayoutParams方法代码示例

本文整理汇总了Java中com.tonicartos.superslim.GridSLM.LayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java GridSLM.LayoutParams方法的具体用法?Java GridSLM.LayoutParams怎么用?Java GridSLM.LayoutParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.tonicartos.superslim.GridSLM的用法示例。


在下文中一共展示了GridSLM.LayoutParams方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onBindViewHolder

import com.tonicartos.superslim.GridSLM; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RVMainAdapter.ViewHolder holder, int position) {
    final Item item = items.get(position);
    final View itemView = holder.itemView;

    holder.bindItem(item.title, item.count, item.label, item.color, item.id);

    final GridSLM.LayoutParams lp = GridSLM.LayoutParams.from(itemView.getLayoutParams());
    // Overrides xml attrs, could use different layouts too.
    if (item.isHeader) {
        lp.headerDisplay = mHeaderDisplay;
        if (lp.isHeaderInline() || (mMarginsFixed && !lp.isHeaderOverlay())) {
            lp.width = ViewGroup.LayoutParams.MATCH_PARENT;
        } else {
            lp.width = ViewGroup.LayoutParams.WRAP_CONTENT;
        }

        lp.headerEndMarginIsAuto = !mMarginsFixed;
        lp.headerStartMarginIsAuto = !mMarginsFixed;
    }
    lp.setSlm(item.sectionManager == LINEAR ? LinearSLM.ID : GridSLM.ID);
    lp.setColumnWidth(mContext.getResources().getDimensionPixelSize(R.dimen.grid_column_width));
    lp.setFirstPosition(item.sectionFirstPosition);
    itemView.setLayoutParams(lp);
}
 
开发者ID:AbduazizKayumov,项目名称:Flashcard-Maker-Android,代码行数:26,代码来源:RVMainAdapter.java

示例2: onBindHeaderViewHolder

import com.tonicartos.superslim.GridSLM; //导入方法依赖的package包/类
public void onBindHeaderViewHolder(RealmViewHolder holder, int position) {
    String header = rowWrappers.get(position).header;
    final GridSLM.LayoutParams layoutParams =
            GridSLM.LayoutParams.from(holder.itemView.getLayoutParams());

    holder.headerTextView.setText(header);
    if (layoutParams.isHeaderInline()) {
        layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
    } else {
        layoutParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;
    }
}
 
开发者ID:jonashao,项目名称:Samantha,代码行数:13,代码来源:RealmBasedRecyclerViewAdapter.java

示例3: onBindViewHolder

import com.tonicartos.superslim.GridSLM; //导入方法依赖的package包/类
/**
 * DON'T OVERRIDE THIS METHOD. Implement onBindRealmViewHolder instead.
 */
@Override
@SuppressWarnings("unchecked")
public final void onBindViewHolder(RealmViewHolder holder, int position) {
    if (getItemViewType(position) == LOAD_MORE_VIEW_TYPE) {
        holder.loadMoreView.showSpinner();
    } else if (getItemViewType(position) == FOOTER_VIEW_TYPE) {
        onBindFooterViewHolder((VH) holder, position);
    } else {
        if (addSectionHeaders) {
            final String header = rowWrappers.get(position).header;
            final GridSLM.LayoutParams layoutParams =
                    GridSLM.LayoutParams.from(holder.itemView.getLayoutParams());
            // Setup the header
            if (header != null) {
                layoutParams.isHeader = true;
                onBindHeaderViewHolder(holder, position);
            } else {
                onBindRealmViewHolder((VH) holder, rowWrappers.get(position).realmIndex);
            }
            layoutParams.setSlm(LinearSLM.ID);
            if (header != null) {
                layoutParams.setFirstPosition(position);
            } else {
                layoutParams.setFirstPosition(rowWrappers.get(position).sectionHeaderIndex);
            }
            holder.itemView.setLayoutParams(layoutParams);
        } else {
            onBindRealmViewHolder((VH) holder, position);
        }
    }
}
 
开发者ID:jonashao,项目名称:Samantha,代码行数:35,代码来源:RealmBasedRecyclerViewAdapter.java

示例4: onBindViewHolder

import com.tonicartos.superslim.GridSLM; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(CountryViewHolder holder, int position) {
    final LineItem item = mSectionGraph.getItem(position);
    final View itemView = holder.itemView;

    holder.bindItem(item.text);

    final GridSLM.LayoutParams lp = new GridSLM.LayoutParams(
            itemView.getLayoutParams());
    // Overrides xml attrs, could use different layouts too.
    if (item.isHeader) {
        lp.headerDisplay = mHeaderDisplay;
        if (lp.isHeaderInline() || (mMarginsFixed && !lp.isHeaderOverlay())) {
            lp.width = ViewGroup.LayoutParams.MATCH_PARENT;
        } else {
            lp.width = ViewGroup.LayoutParams.WRAP_CONTENT;
        }
    }

    if (position == item.sectionFirstPosition) {
        lp.setSlm(item.sectionManager == LINEAR ? LinearSLM.ID : GridSLM.ID);
        lp.marginEnd = mMarginsFixed ? mContext.getResources()
                .getDimensionPixelSize(R.dimen.default_section_marginEnd)
                : LayoutManager.LayoutParams.MARGIN_AUTO;
        lp.marginStart = mMarginsFixed ? mContext.getResources()
                .getDimensionPixelSize(R.dimen.default_section_marginStart)
                : LayoutManager.LayoutParams.MARGIN_AUTO;
        lp.setColumnWidth(mContext.getResources().getDimensionPixelSize(R.dimen.grid_column_width));
    }

    itemView.setLayoutParams(lp);
}
 
开发者ID:dingdingyr,项目名称:SuperSLiM-,代码行数:33,代码来源:CountryNamesAdapter.java


注:本文中的com.tonicartos.superslim.GridSLM.LayoutParams方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。