1
\$\begingroup\$

I am trying to turn some items visibility off when submitting a high score.

I have the following code but it does not appear to work. Any suggestions?

mSignText = (EditText) findViewById(R.id.sign);

submitBtn = (ImageView) this.findViewById(R.id.submitbtn);

mSignText.setVisibility(View.GONE);

submitBtn.setVisibility(View.GONE);

\$\endgroup\$
1
\$\begingroup\$

For visibility, you must use setVisibility as you have done:

  • View.VISIBLE
  • View.INVISIBLE
  • View.GONE

GONE set the view as invisible, and it doesn't take any space for layout purposes.

http://developer.android.com/reference/android/view/View.html#setVisibility

\$\endgroup\$
  • \$\begingroup\$ I tried both GONE and INVISIBLE and neither one seem to work. \$\endgroup\$ – Adam Coburn Oct 13 '10 at 22:43
  • \$\begingroup\$ You must have another problem. I use these functions without problem. Are you sure you have unique ids for each row ? Use this code not in the list but with one unique EditText or ImageView in your Layout. \$\endgroup\$ – Ellis Oct 13 '10 at 23:00
  • \$\begingroup\$ I also wrapped the two items with the unique LinearLayout and tried that to no avail. \$\endgroup\$ – Adam Coburn Oct 13 '10 at 23:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.