Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to invisible a Layout control in android

i'm using following code to set "visibility=gone" for a linear layout

      //onCreate method
      //setcontentview
        . . . . 
      LinearLayout rlayout1 = (LinearLayout) findViewById(R.id.readerBottomLayout);
       rlayout1.setVisibility(2);

But the controls are still visible when activity runs.why? any idea?

like image 378
vnshetty Avatar asked Apr 09 '11 07:04

vnshetty


2 Answers

set rlayout1.setVisibility(View.INVISIBLE)

like image 136
Sunil Pandey Avatar answered Sep 20 '22 15:09

Sunil Pandey


Yes, view.GONE and view.INVISIBLE will work. The reason it didn't work before is because two (2) is the incorrect integer value.

The correct values for set.Visibility are:

0 = visible
4 = invisible 
8 = gone
like image 36
Newbie Avatar answered Sep 18 '22 15:09

Newbie