简体   繁体   中英

How can I manage four spinners on Android?

I have four spinners on Android.

The better way to explain the work of the spinners is this site .

On the left side of the browser, there are four dropdown menus and I want the same build implemented on an Android app, but when one spinner changes it's affecting the other!

spSura.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() 
{
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) 
{
  browse.changeSura();
}
public void onNothingSelected(AdapterView<?> parent) {}

The code above is part of my code and it shows which listener I use.

Your question is not clear for me it's better if you share the full code of the problem. I think you're not able to differentiate between the spinners so add individual id's for each spinner and try to track the change on each of them and give different action as follows

  if(view.getId()){
     case R.id.spinners_1:
      // change spinners 1
         break;
     case case R.id.spinners_2:
       // change spinners 2
          break;
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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