开发者社区 问答 正文

android关于TableRow获取Spinner值 的问题

点击button动态的利用TableRow增加两个spinner和一个“删除”功能的button,

怎样获取所用添加的spinner被选中的值,求大神指教!

部分代码如下:
     private void addRow()  
    {  
        tableRow = new TableRow(this);  
        project = new Spinner(this);  
        time = new Spinner(this);
        delBtn = new Button(this); 
        projectSel = new ArrayList<String>();

        delBtn.setText("删除");  
        delBtn.setOnClickListener(new View.OnClickListener()  
            {     
                @Override  
                public void onClick(View view)  
                {  
                    TableRow tableRow = (TableRow) view.getParent();  
                    tableLayout.removeView(tableRow);  

                }  
            });  
        tableRow.addView(project);  
        tableRow.addView(time);
        tableRow.addView(delBtn);  

        tableLayout.addView(tableRow);  

展开
收起
爵霸 2016-03-09 18:38:19 2380 分享 版权
1 条回答
写回答
取消 提交回答
  • 就是获取上面所有新建的spinner里被选中的值!

    2019-07-17 18:56:34
    赞同 展开评论
问答分类:
问答标签:
问答地址: