Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用 setNewData()方法刷新后recyclerView变小 #33

Closed
Jensen0618 opened this issue May 27, 2016 · 5 comments
Closed

使用 setNewData()方法刷新后recyclerView变小 #33

Jensen0618 opened this issue May 27, 2016 · 5 comments

Comments

@Jensen0618
Copy link

如题,因为有点击item刷新内容的需求,固在item的点击事件里调用了setNewData()方法,但是每刷新一次recyclerView就缩小一次
代码如下:

 mRvCate = (RecyclerView) viewHeaderAds.findViewById(R.id.rv_mall_coin_cate_list);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
        mRvCate.setLayoutManager(linearLayoutManager);
        final BaseQuickAdapter<CateEntity.DataBean.ListBean> mAdapterCate = new BaseQuickAdapter<CateEntity.DataBean.ListBean>(this,
                R.layout.item_mall_coin_cate, mCoinCateData.getList()) {
            @Override
            protected void convert(BaseViewHolder baseViewHolder, CateEntity.DataBean.ListBean listBean) {
                AutoUtils.autoSize(baseViewHolder.getConvertView());
                if (mCoinCateSelected == baseViewHolder.getAdapterPosition()) {
                    baseViewHolder.setBackgroundRes(R.id.arl_mall_coin_cate, R.drawable.mall_coin_selected);
                    baseViewHolder.setTextColor(R.id.tv_mall_coin_cate, getResources().getColor(R.color.color_white_fffeff));
                }
                baseViewHolder.setImageUrl(R.id.iv_mall_coin_cate, listBean.getPic());
                baseViewHolder.setText(R.id.tv_mall_coin_cate, listBean.getName());
            }
        };
        mAdapterCate.setOnRecyclerViewItemClickListener(new BaseQuickAdapter.OnRecyclerViewItemClickListener() {
            @Override
            public void onItemClick(View view, int i) {
//                AutoRelativeLayout viewById = (AutoRelativeLayout) view.findViewById(R.id.arl_mall_coin_cate);
//                viewById.setBackgroundResource(R.drawable.mall_coin_selected);
//                TextView tv = (TextView) view.findViewById(R.id.tv_mall_coin_cate);
//                tv.setTextColor(getResources().getColor(R.color.color_white_ffffff));
                mCoinCateSelected = i;
                mAdapterCate.setNewData(mCoinCateData.getList());
                downProductList(mCoinCateData.getList().get(mCoinCateSelected).getId());
            }
        });
        mRvCate.setAdapter(mAdapterCate);
@CymChad
Copy link
Owner

CymChad commented May 27, 2016

变小?数据量与mCoinCateData.getList()数据量不符?

@CymChad
Copy link
Owner

CymChad commented May 30, 2016

问题解决了没?

@Jensen0618
Copy link
Author

还没,发现刷新列表时就会产生该问题,使用其他类似的适配器库时也会产生该问题

@CymChad
Copy link
Owner

CymChad commented May 30, 2016

是数据问题吗?

@CymChad
Copy link
Owner

CymChad commented May 30, 2016

不是我的adapter问题,我把这个bug关闭了,有什么问题,可以加群哦。

@CymChad CymChad closed this as completed May 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants