Note that there are some explanatory texts on larger screens.

plurals
  1. POswitching between layouts using setvisibility on android not working
    primarykey
    data
    text
    <p>I'm using a screen that I want to switch between layouts on the click of a button. I want both layouts to occupy the full height of the screen, when the button on the first layout is pressed, i want this layout to disappear and the other layout to take it's place, and then same on the next layout.</p> <pre><code>&lt;LinearLayout android:id="@+id/layoutFirst" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; ..... views &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/layoutSecond" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; ..... views &lt;/LinearLayout&gt; </code></pre> <p>On each layout I have a button. I want this button to switch so the other layout occupies the full screen, but nothing happens. The code in the on-click event for the first screen is the following</p> <pre><code>LinearLayout layoutFirst = (LinearLayout) this.findViewById(R.id.layoutFirst); layoutFirst.setVisibility(View.GONE); LinearLayout layoutSecond = (LinearLayout) this.findViewById(R.id.layoutSecond); layoutSecond.setVisibility(View.VISIBLE); </code></pre> <p>Just in case the problem was to do with the fill_parent, I also tried this with the height being set to wrap_content. Initially I can see both layouts on the screen, when I press the button, the layout still does nothing.</p> <p>Can anyone tell me if I am doing something wrong or if there's a way to solve this issue. Any help would be greatly appreciated it</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload