English 中文(简体)
• 如何使无线电台在从胎盘中选取的物品上消失
原标题:how to make radio button disappear on item select from spinner
  • 时间:2012-01-16 06:11:14
  •  标签:
  • java
  • android
rb1=(RadioButton)findViewById(R.id.radioButton1);
rb2=(RadioButton)findViewById(R.id.radioButton2);
rb3=(RadioButton)findViewById(R.id.radioButton3);
rb4=(RadioButton)findViewById(R.id.radioButton4);
rb5=(RadioButton)findViewById(R.id.radioButton5);

spiner1=(Spinner)findViewById(R.id.spinner1);
spiner2=(Spinner)findViewById(R.id.spinner1); 

spiner1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> arg0, View arg1,
                int arg2, long arg3) {

        }

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

        }
    });

如果我先选择1,rb2,rb3,rb5胡 display显示器和休息器,如果先选择2,3,4,5 个 value子,然后hu露出1,4,5 个pl子,告诉我如何为这种一米新 new子书写代码,并试图实施一些 app。 (一) 需要制定法律,并如何为此适用逻辑。

问题回答

There are some demos about spinner Here is an example. you can set dropdown styles in this method

adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

根据你的状况或逻辑,你可以显示/ide。

rb1.setVisibility(View.VISIBLE);   // show
rb2.setVisibility(View.INVISIBLE); // Hide
You can do this : 

spiner1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> adView, View view,int pos, long id) {

              selectedoption = adapter.get(pos);

              if(selectedoption == rb1)
                    {
                     rb1.setVisibility(View.INVISIBLE);
                    }

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


        }
    });




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签