0
如何使用多个纺纱在一个单一的布局,即设置设定在项目中选择监听器上创建多纱厂setOnItemSelectedListener调用的OnCreate
如何使用多个纺纱在一个单一的布局,即设置设定在项目中选择监听器上创建多纱厂setOnItemSelectedListener调用的OnCreate
欢迎SO。你绝对应该阅读FAQ以了解要问什么样的问题以及如何。如果你想得到很好的答案并且不希望你的特权被撤销,你需要对你的问题更加具体,并添加相关的代码和错误消息以表明你已经尝试过。但既然你是新人,我会给你这个。要做到这一点最简单的方法是听众重视各一onCreate()
通过你的XML让每个spinner
参考后
spinner1.setOnItemSelectedListener(this);
spinner2.setOnItemSelectedListener(this;
然后把外面的onCreate()
@Override
public void onItemSelected(AdapterView<?> parent, View view, int arg2,
long arg3)
{
// do whatever you need here depending on what is selected
// you can use a case statement and switch on the id to get the spinner (parent) or view
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
的方法和添加Implements OnItemSelectedListener
在您的Activity
签名。祝你好运,请在将来提出更具体的问题,并添加代码表明你已经做出了尝试。
我的回答是否照顾你的问题? – codeMagic 2013-04-05 23:52:41