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 Answer 1

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\$
3
  • \$\begingroup\$ I tried both GONE and INVISIBLE and neither one seem to work. \$\endgroup\$ Oct 13, 2010 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, 2010 at 23:00
  • \$\begingroup\$ I also wrapped the two items with the unique LinearLayout and tried that to no avail. \$\endgroup\$ Oct 13, 2010 at 23:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .