• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ViewHolder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.zhy.adapter.recyclerview.base.ViewHolder的典型用法代码示例。如果您正苦于以下问题:Java ViewHolder类的具体用法?Java ViewHolder怎么用?Java ViewHolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ViewHolder类属于com.zhy.adapter.recyclerview.base包,在下文中一共展示了ViewHolder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onCreateViewHolder

import com.zhy.adapter.recyclerview.base.ViewHolder; //导入依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
{
    if (isEmpty())
    {
        ViewHolder holder;
        if (mEmptyView != null)
        {
            holder = ViewHolder.createViewHolder(parent.getContext(), mEmptyView);
        } else
        {
            holder = ViewHolder.createViewHolder(parent.getContext(), parent, mEmptyLayoutId);
        }
        return holder;
    }
    return mInnerAdapter.onCreateViewHolder(parent, viewType);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:EmptyWrapper.java


示例2: onCreateViewHolder

import com.zhy.adapter.recyclerview.base.ViewHolder; //导入依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
{
    if (viewType == ITEM_TYPE_LOAD_MORE)
    {
        ViewHolder holder;
        if (mLoadMoreView != null)
        {
            holder = ViewHolder.createViewHolder(parent.getContext(), mLoadMoreView);
        } else
        {
            holder = ViewHolder.createViewHolder(parent.getContext(), parent, mLoadMoreLayoutId);
        }
        return holder;
    }
    return mInnerAdapter.onCreateViewHolder(parent, viewType);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:LoadmoreWrapper.java


示例3: getAdapter

import com.zhy.adapter.recyclerview.base.ViewHolder; //导入依赖的package包/类
private CommonAdapter getAdapter() {
    return new CommonAdapter<Tip>(this,R.layout.item_layout,tips) {

        @Override
        protected void convert(ViewHolder holder, final Tip tip, int position) {

            holder.setText(R.id.poi_field_id,tip.getName());
            holder.setText(R.id.poi_value_id,tip.getDistrict());
            holder.getView(R.id.item_layout).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    EventBus.getDefault().post(tip);
                    finish();
                }
            });
        }
    };
}
 
开发者ID:Vicent9920,项目名称:MyMap,代码行数:19,代码来源:PoiSearchActivity.java


示例4: getAdapter

import com.zhy.adapter.recyclerview.base.ViewHolder; //导入依赖的package包/类
private CommonAdapter getAdapter() {
    return new CommonAdapter<ListViewHoldier>(this,R.layout.item_listview_location,data) {

        @Override
        protected void convert(ViewHolder holder, final ListViewHoldier listViewHoldier, int position) {
            holder.setText(R.id.rl_tv_name,listViewHoldier.title);
            holder.setText(R.id.rl_tv_location,listViewHoldier.address);
            holder.getView(R.id.rl_tv_subit).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
//                    Intent intent = new Intent(mContext,NavigationActivity.class);
//                    intent.putExtra("value",listViewHoldier.lp);
//                    intent.putExtra("address",listViewHoldier.address);
//                    setResult(RESULT_OK,intent);
                    Tip tip = new Tip();
                    tip.setDistrict(listViewHoldier.address);
                    tip.setPostion(listViewHoldier.lp);
                    EventBus.getDefault().postSticky(tip);

                    finish();
                }
            });
        }
    };
}
 
开发者ID:Vicent9920,项目名称:MyMap,代码行数:26,代码来源:PiclocationActivity.java


示例5: convert

import com.zhy.adapter.recyclerview.base.ViewHolder; //导入依赖的package包/类
@Override
protected void convert(ViewHolder holder, final ResolveInfo resolveInfo, int position) {
    holder.setImageDrawable(R.id.image_view_resolver_icon,
            resolveInfo.loadIcon(mPackageManager));
    holder.setText(R.id.text_view_resolve_display_name,
            resolveInfo.loadLabel(mPackageManager).toString());

    holder.getConvertView().setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (mOnResolveInfoListener != null) {
                mOnResolveInfoListener.onResolveInfoClick(resolveInfo);
            }
        }
    });
}
 
开发者ID:JulianAndroid,项目名称:AppChooser,代码行数:17,代码来源:ResolveInfosFragment.java


示例6: onActivityCreated

import com.zhy.adapter.recyclerview.base.ViewHolder; //导入依赖的package包/类
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    int[] intArray = getResources().getIntArray(R.array.colors);
    list.clear();
    for (int anIntArray : intArray) {
        list.add(anIntArray);
    }
    commonAdapter = new CommonAdapter<Integer>(getActivity(), R.layout.item_coupon_dash_line, list) {
        @Override
        protected void convert(ViewHolder holder, Integer s, int position) {
            CouponView couponView = holder.getView(R.id.couponView);
            couponView.setBackgroundColor(s);
        }
    };
    mRecyclerView.addItemDecoration(new RecyclerView.ItemDecoration() {
        @Override
        public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
            super.getItemOffsets(outRect, view, parent, state);
            outRect.set(dp2Px(6), dp2Px(6), dp2Px(6), 0);
        }
    });
    mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
    mRecyclerView.setAdapter(commonAdapter);
}
 
开发者ID:dongjunkun,项目名称:CouponView,代码行数:26,代码来源:CouponDashLineFragment.java


示例7: onActivityCreated

import com.zhy.adapter.recyclerview.base.ViewHolder; //导入依赖的package包/类
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    int[] intArray = getResources().getIntArray(R.array.colors);
    list.clear();
    for (int anIntArray : intArray) {
        list.add(anIntArray);
    }
    commonAdapter = new CommonAdapter<Integer>(getActivity(), R.layout.item_coupon_combination, list) {
        @Override
        protected void convert(ViewHolder holder, Integer s, int position) {
            CouponView couponView = holder.getView(R.id.couponView);
            couponView.setBackgroundColor(s);
        }
    };
    mRecyclerView.addItemDecoration(new RecyclerView.ItemDecoration() {
        @Override
        public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
            super.getItemOffsets(outRect, view, parent, state);
            outRect.set(dp2Px(6), dp2Px(6), dp2Px(6), 0);
        }
    });
    mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
    mRecyclerView.setAdapter(commonAdapter);
}
 
开发者ID:dongjunkun,项目名称:CouponView,代码行数:26,代码来源:CouponCombinationFragment.java


示例8: onCreateViewHolder

import com.zhy.adapter.recyclerview.base.ViewHolder; //导入依赖的package包/类
@Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
    {
//        Log.d("LoadMoreCommonAdapter","onCreateViewHolder");
        if (viewType == ITEM_TYPE_LOAD_MORE)
        {
            ViewHolder holder;
            if (mLoadMoreView != null)
            {
                holder = ViewHolder.createViewHolder(parent.getContext(), mLoadMoreView);
            } else
            {
                holder = ViewHolder.createViewHolder(parent.getContext(), parent, mLoadMoreLayoutId);
            }
            return holder;
        }
        return super.onCreateViewHolder(parent, viewType);
    }
 
开发者ID:a371166028,项目名称:likequanmintv,代码行数:19,代码来源:LoadMoreCommonAdapter.java


示例9: convertItem

import com.zhy.adapter.recyclerview.base.ViewHolder; //导入依赖的package包/类
@Override
protected void convertItem(ViewHolder holder, final PlayBean playBean, int position) {
    holder.setImageUrl(R.id.thumnails,playBean.thumb,new GlideRoundTransform(mActivity,5));
    holder.setText(R.id.title,playBean.title);
    holder.setText(R.id.tv_viewnum,playBean.view);
    holder.setText(R.id.nickName,playBean.nick);
    holder.setImageUrl(R.id.ic_head,playBean.avatar,new GlideCircleTransform(mActivity));
    holder.getItemView().setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent =new Intent(mActivity, CommonLiveUI.class);
            intent.putExtra("playBean",playBean);
            getActivity().startActivity(intent);
            getActivity().overridePendingTransition(R.anim.anim_slide_in_right,R.anim.anim_slide_out_left);
        }
    });
}
 
开发者ID:a371166028,项目名称:likequanmintv,代码行数:18,代码来源:BaseLiveWraperFragment.java


示例10: convert

import com.zhy.adapter.recyclerview.base.ViewHolder; //导入依赖的package包/类
@Override
public void convert(ViewHolder holder, ChatMessage chatMessage, int position)
{
    holder.setText(R.id.chat_send_content, chatMessage.getContent());
    holder.setText(R.id.chat_send_name, chatMessage.getName());
    holder.setImageResource(R.id.chat_send_icon, chatMessage.getIcon());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:MsgSendItemDelagate.java


示例11: convert

import com.zhy.adapter.recyclerview.base.ViewHolder; //导入依赖的package包/类
@Override
public void convert(ViewHolder holder, ChatMessage chatMessage, int position)
{
    holder.setText(R.id.chat_from_content, chatMessage.getContent());
    holder.setText(R.id.chat_from_name, chatMessage.getName());
    holder.setImageResource(R.id.chat_from_icon, chatMessage.getIcon());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:MsgComingItemDelagate.java


示例12: onCreateViewHolder

import com.zhy.adapter.recyclerview.base.ViewHolder; //导入依赖的package包/类
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    ItemViewDelegate itemViewDelegate = mItemViewDelegateManager.getItemViewDelegate(viewType);
    int layoutId = itemViewDelegate.getItemViewLayoutId();
    ViewHolder holder = ViewHolder.createViewHolder(mContext, parent, layoutId);
    onViewHolderCreated(holder,holder.getConvertView());
    setListener(parent, holder, viewType);
    return holder;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:MultiItemTypeAdapter.java


示例13: onViewAttachedToWindow

import com.zhy.adapter.recyclerview.base.ViewHolder; //导入依赖的package包/类
@Override
public void onViewAttachedToWindow(RecyclerView.ViewHolder holder)
{
    mInnerAdapter.onViewAttachedToWindow(holder);
    if (isEmpty())
    {
        WrapperUtils.setFullSpan(holder);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:EmptyWrapper.java


示例14: onBindViewHolder

import com.zhy.adapter.recyclerview.base.ViewHolder; //导入依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position)
{
    if (isEmpty())
    {
        return;
    }
    mInnerAdapter.onBindViewHolder(holder, position);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:EmptyWrapper.java


示例15: onBindViewHolder

import com.zhy.adapter.recyclerview.base.ViewHolder; //导入依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position)
{
    if (isShowLoadMore(position))
    {
        if (mOnLoadMoreListener != null)
        {
            mOnLoadMoreListener.onLoadMoreRequested();
        }
        return;
    }
    mInnerAdapter.onBindViewHolder(holder, position);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:LoadmoreWrapper.java


示例16: onViewAttachedToWindow

import com.zhy.adapter.recyclerview.base.ViewHolder; //导入依赖的package包/类
@Override
public void onViewAttachedToWindow(RecyclerView.ViewHolder holder)
{
    mInnerAdapter.onViewAttachedToWindow(holder);

    if (isShowLoadMore(holder.getLayoutPosition()))
    {
        setFullSpan(holder);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:LoadmoreWrapper.java


示例17: setFullSpan

import com.zhy.adapter.recyclerview.base.ViewHolder; //导入依赖的package包/类
private 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);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:LoadmoreWrapper.java


示例18: onBindViewHolder

import com.zhy.adapter.recyclerview.base.ViewHolder; //导入依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position)
{
    if (isHeaderViewPos(position))
    {
        return;
    }
    if (isFooterViewPos(position))
    {
        return;
    }
    mInnerAdapter.onBindViewHolder(holder, position - getHeadersCount());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:HeaderAndFooterWrapper.java


示例19: onViewAttachedToWindow

import com.zhy.adapter.recyclerview.base.ViewHolder; //导入依赖的package包/类
@Override
public void onViewAttachedToWindow(RecyclerView.ViewHolder holder)
{
    mInnerAdapter.onViewAttachedToWindow(holder);
    int position = holder.getLayoutPosition();
    if (isHeaderViewPos(position) || isFooterViewPos(position))
    {
        WrapperUtils.setFullSpan(holder);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:HeaderAndFooterWrapper.java


示例20: onItemClick

import com.zhy.adapter.recyclerview.base.ViewHolder; //导入依赖的package包/类
@Override
public void onItemClick(View view, RecyclerView.ViewHolder holder, int position) {

    ShoppingCart item = getItem(position);
    item.setIsChecked(!item.isChecked());            //如果选中,点击后就不选    如果没选,就选中
    notifyItemChanged(position);

    /**
     * 还需要监听其他的是否选中.
     * 主要是用于 全选 和 全不选
     */
    checkListen();
    showTotalPrice();
}
 
开发者ID:gaolhjy,项目名称:cniao5,代码行数:15,代码来源:ShopCartAdapter.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AudioTrackInfo类代码示例发布时间:2022-05-22
下一篇:
Java MultiFileSplit类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap