本文整理汇总了Java中android.support.v7.widget.StaggeredGridLayoutManager.LayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java StaggeredGridLayoutManager.LayoutParams方法的具体用法?Java StaggeredGridLayoutManager.LayoutParams怎么用?Java StaggeredGridLayoutManager.LayoutParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.widget.StaggeredGridLayoutManager
的用法示例。
在下文中一共展示了StaggeredGridLayoutManager.LayoutParams方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateViewHolder
import android.support.v7.widget.StaggeredGridLayoutManager; //导入方法依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = null;
if (viewType == TYPE_HEADER) {
itemView = headerView;
} else if (viewType == TYPE_FOOTER) {
itemView = footerView;
}
if (itemView != null) {
//set StaggeredGridLayoutManager header & footer view
if (layoutManager instanceof StaggeredGridLayoutManager) {
ViewGroup.LayoutParams targetParams = itemView.getLayoutParams();
StaggeredGridLayoutManager.LayoutParams StaggerLayoutParams;
if (targetParams != null) {
StaggerLayoutParams = new StaggeredGridLayoutManager.LayoutParams(targetParams.width, targetParams.height);
} else {
StaggerLayoutParams = new StaggeredGridLayoutManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
}
StaggerLayoutParams.setFullSpan(true);
itemView.setLayoutParams(StaggerLayoutParams);
}
return new RecyclerView.ViewHolder(itemView) {
};
}
return super.onCreateViewHolder(parent, viewType);
}
示例2: onBindViewHolder
import android.support.v7.widget.StaggeredGridLayoutManager; //导入方法依赖的package包/类
@Override
public void onBindViewHolder( BaseViewHolder viewHolder, final int position ){
super.onBindViewHolder( viewHolder, position );
BaseItem i = getPresenter().getItem( position );
if( getItemViewType( position ) == TYPE_BEER_PRODUCT ){
final BeerProductItem item = (BeerProductItem) i;
BeerProductHolder holder = (BeerProductHolder) viewHolder;
holder.onBind( item );
holder.setOnClickBeerListener( onClickBeer( item ) );
}else if( getItemViewType( position ) == BaseItemType.TYPE_PROGRESS ){
StaggeredGridLayoutManager.LayoutParams layoutParams =
(StaggeredGridLayoutManager.LayoutParams) viewHolder.itemView.getLayoutParams();
layoutParams.setFullSpan( true );
viewHolder.itemView.setLayoutParams( layoutParams );
}
}
示例3: ExpandableHeaderViewHolder
import android.support.v7.widget.StaggeredGridLayoutManager; //导入方法依赖的package包/类
ExpandableHeaderViewHolder(View view, FlexibleAdapter adapter) {
super(view, adapter, true);//True for sticky
mTitle = (TextView) view.findViewById(R.id.title);
mSubtitle = (TextView) view.findViewById(R.id.subtitle);
this.mHandleView = (ImageView) view.findViewById(R.id.row_handle);
if (adapter.isHandleDragEnabled()) {
this.mHandleView.setVisibility(View.VISIBLE);
setDragHandleView(mHandleView);
} else {
this.mHandleView.setVisibility(View.GONE);
}
//Support for StaggeredGridLayoutManager
if (itemView.getLayoutParams() instanceof StaggeredGridLayoutManager.LayoutParams) {
((StaggeredGridLayoutManager.LayoutParams) itemView.getLayoutParams()).setFullSpan(true);
}
}
示例4: onViewAttachedToWindow
import android.support.v7.widget.StaggeredGridLayoutManager; //导入方法依赖的package包/类
@Override
public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) {
super.onViewAttachedToWindow(holder);
ViewGroup.LayoutParams lp = holder.itemView.getLayoutParams();
if (lp != null
&& lp instanceof StaggeredGridLayoutManager.LayoutParams
&& (isHeader(holder.getLayoutPosition()) || isRefreshHeader(holder.getLayoutPosition()) || isFooter(holder.getLayoutPosition()))) {
StaggeredGridLayoutManager.LayoutParams p = (StaggeredGridLayoutManager.LayoutParams) lp;
p.setFullSpan(true);
}
adapter.onViewAttachedToWindow(holder);
}
示例5: onViewAttachedToWindow
import android.support.v7.widget.StaggeredGridLayoutManager; //导入方法依赖的package包/类
@Override
public void onViewAttachedToWindow(XViewHolder holder) {
super.onViewAttachedToWindow(holder);
int position = holder.getLayoutPosition();
if (isFooterPosition(position)||isHeaderPosition(position)) {
ViewGroup.LayoutParams lp = holder.itemView.getLayoutParams();
if (lp != null && lp instanceof StaggeredGridLayoutManager.LayoutParams) {
StaggeredGridLayoutManager.LayoutParams p = (StaggeredGridLayoutManager.LayoutParams) lp;
p.setFullSpan(true);
}
}
}
示例6: onViewAttachedToWindow
import android.support.v7.widget.StaggeredGridLayoutManager; //导入方法依赖的package包/类
@Override
public void onViewAttachedToWindow(BaseRecyclerViewHolder holder)
{
super.onViewAttachedToWindow(holder);
ViewGroup.LayoutParams lp = holder.itemView.getLayoutParams();
if (lp != null && lp instanceof StaggeredGridLayoutManager.LayoutParams && holder.getLayoutPosition() == 0)
{
StaggeredGridLayoutManager.LayoutParams p = (StaggeredGridLayoutManager.LayoutParams)lp;
p.setFullSpan(true);
}
}
示例7: onViewAttachedToWindow
import android.support.v7.widget.StaggeredGridLayoutManager; //导入方法依赖的package包/类
@Override
public void onViewAttachedToWindow(ViewHolder holder) {
super.onViewAttachedToWindow(holder);
ViewGroup.LayoutParams lp = holder.itemView.getLayoutParams();
if (lp != null
&& lp instanceof StaggeredGridLayoutManager.LayoutParams
&& (isFooter(holder.getLayoutPosition()))) {
StaggeredGridLayoutManager.LayoutParams p = (StaggeredGridLayoutManager.LayoutParams) lp;
p.setFullSpan(true);
}
adapter.onViewAttachedToWindow(holder);
}
示例8: onViewAttachedToWindow
import android.support.v7.widget.StaggeredGridLayoutManager; //导入方法依赖的package包/类
@Override
public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) {
super.onViewAttachedToWindow(holder);
ViewGroup.LayoutParams lp = holder.itemView.getLayoutParams();
if (lp != null
&& lp instanceof StaggeredGridLayoutManager.LayoutParams
&& (isHeader(holder.getLayoutPosition()) || isFooter(holder.getLayoutPosition()))) {
StaggeredGridLayoutManager.LayoutParams p = (StaggeredGridLayoutManager.LayoutParams) lp;
p.setFullSpan(true);
}
}
示例9: setFullSpan
import android.support.v7.widget.StaggeredGridLayoutManager; //导入方法依赖的package包/类
public static void setFullSpan(RecyclerView.ViewHolder holder)
{
ViewGroup.LayoutParams lp = holder.itemView.getLayoutParams();
if (lp != null
&& lp instanceof StaggeredGridLayoutManager.LayoutParams)
{
StaggeredGridLayoutManager.LayoutParams p = (StaggeredGridLayoutManager.LayoutParams) lp;
p.setFullSpan(true);
}
}
示例10: onViewAttachedToWindow
import android.support.v7.widget.StaggeredGridLayoutManager; //导入方法依赖的package包/类
@Override
public void onViewAttachedToWindow(ViewHolder holder) {
super.onViewAttachedToWindow(holder);
ViewGroup.LayoutParams lp = holder.itemView.getLayoutParams();
if (lp != null
&& lp instanceof StaggeredGridLayoutManager.LayoutParams
&& (isHeader(holder.getLayoutPosition()) || isFooter(holder.getLayoutPosition()))) {
StaggeredGridLayoutManager.LayoutParams p = (StaggeredGridLayoutManager.LayoutParams) lp;
p.setFullSpan(true);
}
}
示例11: refreshAdapter
import android.support.v7.widget.StaggeredGridLayoutManager; //导入方法依赖的package包/类
private void refreshAdapter(BaseRecyclerAdapter adapter, RecyclerView.LayoutManager manager) {
if (false && adapter != null && manager != null && !mRefreshAdapter && !hasLoadCompleted()) {
if (!(manager instanceof GridLayoutManager)) {
View footerView = adapter.getCustomLoadMoreView();
if (footerView != null) {
ViewGroup.LayoutParams layoutParams = footerView.getLayoutParams();
if (layoutParams instanceof StaggeredGridLayoutManager.LayoutParams) {
Utils.setFullSpan((StaggeredGridLayoutManager.LayoutParams) layoutParams);
mRefreshAdapter = true;
}
}
}
}
}
示例12: onViewAttachedToWindow
import android.support.v7.widget.StaggeredGridLayoutManager; //导入方法依赖的package包/类
@Override
public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) {
super.onViewAttachedToWindow(holder);
ViewGroup.LayoutParams lp = holder.itemView.getLayoutParams();
if (lp != null
&& lp instanceof StaggeredGridLayoutManager.LayoutParams
&& holder.getLayoutPosition() == adapter.getItemCount()) {
StaggeredGridLayoutManager.LayoutParams p = (StaggeredGridLayoutManager.LayoutParams) lp;
p.setFullSpan(true);
}
}
示例13: onViewAttachedToWindow
import android.support.v7.widget.StaggeredGridLayoutManager; //导入方法依赖的package包/类
public static void onViewAttachedToWindow(RecyclerView.ViewHolder holder, RecyclerView.Adapter adapter, int pinnedHeaderType) {
// 如果是瀑布流布局,这里处理标签的布局占满一行
final ViewGroup.LayoutParams lp = holder.itemView.getLayoutParams();
if (lp instanceof StaggeredGridLayoutManager.LayoutParams) {
final StaggeredGridLayoutManager.LayoutParams slp = (StaggeredGridLayoutManager.LayoutParams) lp;
slp.setFullSpan(adapter.getItemViewType(holder.getLayoutPosition()) == pinnedHeaderType);
}
}
示例14: onViewAttachedToWindow
import android.support.v7.widget.StaggeredGridLayoutManager; //导入方法依赖的package包/类
@Override
public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) {
super.onViewAttachedToWindow(holder);
int position = holder.getLayoutPosition();
int type = getItemViewType(position);
if (isFullSpanType(type)) {
ViewGroup.LayoutParams layoutParams = holder.itemView.getLayoutParams();
if (layoutParams instanceof StaggeredGridLayoutManager.LayoutParams) {
StaggeredGridLayoutManager.LayoutParams lp = (StaggeredGridLayoutManager.LayoutParams) layoutParams;
lp.setFullSpan(true);
}
}
}
示例15: setFullSpan
import android.support.v7.widget.StaggeredGridLayoutManager; //导入方法依赖的package包/类
public static void setFullSpan(RecyclerView.ViewHolder holder) {
ViewGroup.LayoutParams lp = holder.itemView.getLayoutParams();
if (lp != null
&& lp instanceof StaggeredGridLayoutManager.LayoutParams) {
StaggeredGridLayoutManager.LayoutParams p = (StaggeredGridLayoutManager.LayoutParams) lp;
p.setFullSpan(true);
}
}