简体   繁体   中英

Android: How to make a Spinner invisible and then visible again?

I have the following Spinner :

Spinner spinner = (Spinner)findViewById(R.id.sp1);

and I initially make it invisible like this:

spinner.setVisibility(TRIM_MEMORY_BACKGROUND);

This does make the Spinner invisible but how to make it visible again?

Thanks in advance.

//Hide

spinner.setVisibility(View.GONE);

//Show

spinner.setVisibility(View.VISIBLE);

if you want to change via xml code

// HIDE

  android:visibility="invisible"

//SHOW

  android:visibility="visible"

// i am not sure about this one, it too hides, but why we have this, anyone can clear me?

  android:visibility="gone"

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