blend blend - 27 days ago 10
Android Question

android - make a spinner or not pprogrammatically

This is a spinner defined in the xml layout below.

<Spinner
android:id="@+id/spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />


I am using the spinner in the activity class as shown below

void spinner(){
spMem=(Spinner)findViewById(R.id.spinner);
adapterMem=new ArrayAdapter<String>(this,R.layout.spinner_layout,R.id.txt,listItemsMem);
spMem.setAdapter(adapterMem);
spMem.setOnItemSelectedListener(
new AdapterView.OnItemSelectedListener() {
........................


considering that when the above method is called, how can I disabled it from appearing from a users sight.

Answer Source

every view has a setVisibility() method. you can use it to set a view's appearance to INVISIBLE, GONE and VISIBLE.