android spinner二级联动有时候点击不出来没效果

首席大供奉 发布于 2015/05/26 13:45
阅读 530
收藏 1
用是可以用  ,,,,

第一次点击要点击边上  第二次点击 点击边上就没效果了   不出来内容列表了   跟没监听一样 要点中间    退出这个页面   在进入  有得点边上   然后后面一样  要点中间  点边上不行   这就让人很纠结 、、、、、、有没有大神

这是相关代码   有需要我在贴   求帮忙!!


loadingSpinner(null, rootAdapter, rootCates, rootSpinner, new NetUitl.CallBack() {
                @Override
                public void handleResponse(String response) {
                    loadingSpinner(response, subAdapter, subCates, subSpinner, null);
                }
            });
        }
    }
    private void loadingSpinner(final String id, final CateAdapter adapter, final List<Cate> cates,
                                final Spinner spinner, final NetUitl.CallBack back) {
            CateUtil.getCate(id, new NetUitl.CallBack() {
                @Override
                public void handleResponse(String response) {
                    response = response.trim();
                    if (!response.startsWith("{") || !response.endsWith("}"))
                        return;
                    ListResponse<Cate> listResponse = JsonUtil.parseListResponse(response, Cate.class);
                    List<Cate> tmpCates = listResponse.getData();
                    cates.clear();
                    if (tmpCates != null && tmpCates.size() > 0) {
                        for (int i = 0; i < tmpCates.size(); i++) {
                            cates.add(tmpCates.get(i));
                            if (goodsCateName.contains(tmpCates.get(i).getCate_name())) {
                                position = i;
                            }
                        }
                    } else {
                        cates.add(position_cate);
                        position = 0;
                    }
                    spinner.setSelection(position, true);
                    adapter.notifyDataSetChanged();
                    if (back != null) {
                        back.handleResponse(cates.get(position).getCate_id());
                    }
                }

            });


监听里面的!

public void clickSpinnerItem(int witch, int position) {
        goodsCateName = "";
        switch (witch) {
            case ROOT_TAG:
                rootSpinner.setSelection(position, true);
                position_cate =rootCates.get(position);
                loadingSpinner(rootCates.get(position).getCate_id(), subAdapter, subCates,
                        subSpinner, null);
                VendorApplication.root_spinner = position;
                break;
            case SUB_TAG:
                subSpinner.setSelection(position, true);
                position_id = subCates.get(position).getCate_name();
                VendorApplication.sub_spinner = position;
                Intent intent = new Intent(EditShopActivity.this, CategoryGoodsActivity.class);
                intent.putExtra(Global.KEY_CATE_NAME, position_id);
                intent.putExtra(Global.KEY_STATE, 2);
                startActivity(intent);
                break;
        }
    }



加载中
0
首席大供奉
首席大供奉
也就是说     是spinner本身的点击事件   有问题 !!  这个不应该啊  !!
返回顶部
顶部