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

Java ViewHolder类代码示例

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

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



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

示例1: onCreateView

import com.zhy.base.adapter.ViewHolder; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState)
{
    View view = inflater.inflate(R.layout.fragment_tab, container, false);
    mRecyclerView = (RecyclerView) view
            .findViewById(R.id.id_stickynavlayout_innerscrollview);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    // mTextView = (TextView) view.findViewById(R.id.id_info);
    // mTextView.setText(mTitle);
    for (int i = 0; i < 50; i++)
    {
        mDatas.add(mTitle + " -> " + i);
    }
    mRecyclerView.setAdapter(new CommonAdapter<String>(getActivity(), R.layout.item, mDatas)
    {
        @Override
        public void convert(ViewHolder holder, String o)
        {
            holder.setText(R.id.id_info, o);
        }
    });

    return view;

}
 
开发者ID:zuoni1018,项目名称:CoordinatorLayoutExample-master,代码行数:27,代码来源:TabFragment.java


示例2: onCreateView

import com.zhy.base.adapter.ViewHolder; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_tab, container, false);
    mRecyclerView = (RecyclerView) view.findViewById(R.id.id_stickynavlayout_innerscrollview);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    for (int i = 0; i < 50; i++) {
        mDatas.add(mTitle + " -> " + i);
    }
    mRecyclerView.setAdapter(new CommonAdapter<String>(getActivity(), R.layout.item, mDatas) {
        @Override
        public void convert(ViewHolder holder, String o) {
            holder.setText(R.id.id_info, o);
        }
    });

    return view;
}
 
开发者ID:wuhighway,项目名称:DailyStudy,代码行数:18,代码来源:TabFragment.java


示例3: convert

import com.zhy.base.adapter.ViewHolder; //导入依赖的package包/类
@Override
public void convert(ViewHolder holder, ChatMessage chatMessage)
{

    switch (holder.getLayoutId())
    {
        case R.layout.main_chat_from_msg:
            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());
            break;
        case R.layout.main_chat_send_msg:
            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());
            break;
    }
}
 
开发者ID:Dreamer206602,项目名称:baseAdapter-master,代码行数:19,代码来源:ChatAdapterForRv.java


示例4: onCreate

import com.zhy.base.adapter.ViewHolder; //导入依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_recyclerview);

        initDatas();

        mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview);

        mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
        mRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));

//        mRecyclerView.setAdapter(new CommonAdapter<String>(this, R.layout.item_list, mDatas)
//        {
//            @Override
//            public void convert(ViewHolder holder, String s)
//            {
//                holder.setText(R.id.id_item_list_title, s);
//
//            }
//        });
       mRecyclerView.setAdapter(new CommonAdapter<User>(this,R.layout.item_list,mDatas) {
           @Override
           public void convert(ViewHolder holder, User user) {
               holder.setText(R.id.id_item_list_title,user.getName());
               holder.setImageUrl(R.id.iv,user.getUrl());

           }

       });

    }
 
开发者ID:Dreamer206602,项目名称:baseAdapter-master,代码行数:34,代码来源:RecyclerViewActivity.java


示例5: onCreateViewHolder

import com.zhy.base.adapter.ViewHolder; //导入依赖的package包/类
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
{
    int layoutId = mMultiItemTypeSupport.getLayoutId(viewType);
    ViewHolder holder = ViewHolder.get(mContext, null, parent, layoutId, -1);
    setListener(parent, holder, viewType);
    return holder;
}
 
开发者ID:Dreamer206602,项目名称:baseAdapter-master,代码行数:9,代码来源:MultiItemCommonAdapter.java


示例6: onCreateViewHolder

import com.zhy.base.adapter.ViewHolder; //导入依赖的package包/类
@Override
public ViewHolder onCreateViewHolder(final ViewGroup parent, int viewType)
{
    ViewHolder viewHolder = ViewHolder.get(mContext, null, parent, mLayoutId, -1);
    setListener(parent, viewHolder, viewType);
    return viewHolder;
}
 
开发者ID:Dreamer206602,项目名称:baseAdapter-master,代码行数:8,代码来源:CommonAdapter.java


示例7: onBindViewHolder

import com.zhy.base.adapter.ViewHolder; //导入依赖的package包/类
@Override
public void onBindViewHolder(ViewHolder holder, int position)
{
    position = getIndexForPosition(position);
    if (holder.getItemViewType() == TYPE_SECTION)
    {
        holder.setText(mSectionSupport.sectionTitleTextViewId(), mSectionSupport.getTitle(mDatas.get(position)));
        return;
    }
    super.onBindViewHolder(holder, position);
}
 
开发者ID:Dreamer206602,项目名称:baseAdapter-master,代码行数:12,代码来源:SectionAdapter.java


示例8: getView

import com.zhy.base.adapter.ViewHolder; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
    if (mMultiItemTypeSupport == null)
        return super.getView(position, convertView, parent);

    int layoutId = mMultiItemTypeSupport.getLayoutId(position,
            getItem(position));
    ViewHolder viewHolder = ViewHolder.get(mContext, convertView, parent,
            layoutId, position);
    convert(viewHolder, getItem(position));
    return viewHolder.getConvertView();
}
 
开发者ID:Dreamer206602,项目名称:baseAdapter-master,代码行数:14,代码来源:MultiItemCommonAdapter.java


示例9: getView

import com.zhy.base.adapter.ViewHolder; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
	ViewHolder holder = ViewHolder.get(mContext, convertView, parent,
			layoutId, position);
	convert(holder, getItem(position));
	return holder.getConvertView();
}
 
开发者ID:Dreamer206602,项目名称:baseAdapter-master,代码行数:9,代码来源:CommonAdapter.java


示例10: onViewCreated

import com.zhy.base.adapter.ViewHolder; //导入依赖的package包/类
@Override
public void onViewCreated(final View view, @Nullable Bundle savedInstanceState)
{
    initDatas();

    mListView = (ListView) view.findViewById(R.id.id_listview);
    mListView.setAdapter(new CommonAdapter<List<String>>(getActivity(), R.layout.item_for_listview, mDatas)
    {
        Map<Integer, Set<Integer>> selectedMap = new HashMap<Integer, Set<Integer>>();


        @Override
        public void convert(final ViewHolder viewHolder, List<String> strings)
        {
            TagFlowLayout tagFlowLayout = viewHolder.getView(R.id.id_tagflowlayout);

            TagAdapter<String> tagAdapter = new TagAdapter<String>(strings)
            {
                @Override
                public View getView(FlowLayout parent, int position, String o)
                {
                    //can use viewholder
                    TextView tv = (TextView) mInflater.inflate(R.layout.tv,
                            parent, false);
                    tv.setText(o);
                    return tv;
                }
            };
            tagFlowLayout.setAdapter(tagAdapter);
            //重置状态
            tagAdapter.setSelectedList(selectedMap.get(viewHolder.getItemPosition()));

            tagFlowLayout.setOnSelectListener(new TagFlowLayout.OnSelectListener()
            {
                @Override
                public void onSelected(Set<Integer> selectPosSet)
                {
                    selectedMap.put(viewHolder.getItemPosition(), selectPosSet);
                }
            });
        }
    });

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:45,代码来源:ListViewTestFragment.java


示例11: getPosition

import com.zhy.base.adapter.ViewHolder; //导入依赖的package包/类
protected int getPosition(RecyclerView.ViewHolder viewHolder)
{
    return viewHolder.getAdapterPosition();
}
 
开发者ID:Dreamer206602,项目名称:baseAdapter-master,代码行数:5,代码来源:CommonAdapter.java


示例12: onBindViewHolder

import com.zhy.base.adapter.ViewHolder; //导入依赖的package包/类
@Override
public void onBindViewHolder(ViewHolder holder, int position)
{
    holder.updatePosition(position);
    convert(holder, mDatas.get(position));
}
 
开发者ID:Dreamer206602,项目名称:baseAdapter-master,代码行数:7,代码来源:CommonAdapter.java


示例13: getPosition

import com.zhy.base.adapter.ViewHolder; //导入依赖的package包/类
@Override
protected int getPosition(RecyclerView.ViewHolder viewHolder)
{
    return getIndexForPosition(viewHolder.getAdapterPosition());
}
 
开发者ID:Dreamer206602,项目名称:baseAdapter-master,代码行数:6,代码来源:SectionAdapter.java


示例14: convert

import com.zhy.base.adapter.ViewHolder; //导入依赖的package包/类
public abstract void convert(ViewHolder holder, T t); 
开发者ID:Dreamer206602,项目名称:baseAdapter-master,代码行数:2,代码来源:CommonAdapter.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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