Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You could have your layouts in a single xml file. The ones you don't want to see immediately, set <code>android:visibility="gone"</code>in the XML, and at runtime you would do a call to <code>hiddenView.setVisibility(View.VISIBLE);</code>.</p> <p>Your XML would look something like this:</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;LinearLayout android:id="@+id/layout1" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/layout2" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;/LinearLayout&gt; &lt;/RelativeLayout&gt; </code></pre> <p>at runtime you could do:</p> <pre><code>layout1.setVisibility(View.GONE); layout2.setVisibility(View.VISIBLE); </code></pre> <p>This would essentially create the appearance of the layouts swapping.</p> <p>I believe this would also work if you have shared objects between the two layouts. Just make sure you set the id first using <code>android:id="@+id/view1"</code> and every subsequent setting of this id you would do <code>android:id="@id/view1"</code> (without the +).</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;LinearLayout android:id="@+id/layout1" android:layout_width="fill_parent"&gt; &lt;View android:id="@+id/view1"/&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/layout2" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;View android:id="@id/view1"/&gt; &lt;/LinearLayout&gt; &lt;/RelativeLayout&gt; </code></pre>
    singulars
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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