简体   繁体   English

如何从自定义列表视图获取组合框的价值

[英]How to get value of combobox from custom list view

I have one application in that I have to show button and combo box in custom list view .I have add button and combo box using base adapter. 我有一个应用程序,我必须在自定义列表视图中显示按钮和组合框。我使用基本适配器添加按钮和组合框。 But the value of combo box not found.I tried on selection listener but not work 但是找不到组合框的值。我尝试了选择侦听器但没有用

![enter image description here][1] ![在此处输入图片描述] [1]

Here I have combo box within list items and I want to retrive value from it for each list item 在这里,我在列表项中有一个组合框,我想从中获取每个列表项的值

I tried the following code but not work 我尝试了以下代码,但不起作用

 holder.spindata.setOnItemSelectedListener(new OnItemSelectedListener() {

    @Override
    public void onItemSelected(AdapterView<?> parent, View view,
            int position, long id) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onNothingSelected(AdapterView<?> parent) {
        // TODO Auto-generated method stub

    }
});

public void onItemSelected(AdapterView parent, View view, int position, long id) { public void onItemSelected(AdapterView parent,View view,int position,long id){

ComboBox b=view.findViewById(R.id.your_comboBox_name); 组合框b = view.findViewById(R.id.your_comboBox_name);

    //After that check that this combo Box checked or not

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM