Handel多选或在recyclerView中选择radioButton在另一个recyclerView里面

时间:2017-03-06 11:15:58

标签: android android-recyclerview recycler-adapter

我有活动包含父multirow recyclerView在每个元素中都有tow属性(问题,在子recyclelerView中的答案)就像这样

this show what I mean

我的问题在这里,我怎样才能处理每个儿童回收商的选择,直到用户滚动回收商查看时没有删除或重复

这是我的onBindViewHolder代码:

 @Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {

    // get objects
    final FollowQuestionModel item = data.get(position);
    if (item != null) {

        switch (item.getType()) {

            case SINGLE_TYPE:

                ((SingleViewHolder) holder).tvSingleChoice.setText(item.getSingleChoiceModel().get(position).getQuestion());

                ((SingleViewHolder) holder).rvSingleChoice.setLayoutManager(new GridLayoutManager(context , 2));
                SingleAnswersElementAdapter singleAdapter = new SingleAnswersElementAdapter(context, item.getSingleChoiceModel().get(position).getAnswers()
                        , R.layout.item_single_choice_element);
                ((SingleViewHolder) holder).rvSingleChoice.setAdapter(singleAdapter);

                break;

            case MULTI_TYPE:

                ((MultiViewHolder) holder).tvMultiChoice.setText(item.getSingleChoiceModel().get(position).getQuestion());

                ((MultiViewHolder) holder).rvMulitChoice.setLayoutManager(new GridLayoutManager(context , 2));
                MultiAnswersElementAdapter multiAdapter = new MultiAnswersElementAdapter(context, item.getMultiChoiceModel().get(position).getAnswers()
                        , R.layout.item_multi_choice_element);
                ((MultiViewHolder) holder).rvMulitChoice.setAdapter(multiAdapter);

                break;

            case TEXT_TYPE:

                ((TextViewHolder) holder).tvTextQuestion.setText(item.getTextChoiceModel().get(position).getQuestion().get(position).getQuestion());

                break;
        }
    }
}

感谢

0 个答案:

没有答案