Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding content to a linear layout dynamically?
    primarykey
    data
    text
    <p>If for example I have defined a root linear layout whose orientation is vertical:</p> <p><strong>main.xml</strong>:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/my_root" android:layout_height="wrap_content" android:layout_width="fill_parent" android:orientation="vertical" &lt;!-- I would like to add content here dynamically.--&gt; &lt;/LinearLayout&gt; </code></pre> <p>Inside the root linear layout, I would like to add multiple <em>child linear layouts</em>, each of the child linear layout orientation is <em>horizontal</em>. With all these I could end up with a table like output. </p> <p>For example root with <em>child</em> layout such as:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/my_root" android:layout_height="wrap_content" android:layout_width="fill_parent" android:orientation="vertical" &lt;!-- 1st child (1st row)--&gt; &lt;LinearLayout ... android:orientation="horizontal"&gt; &lt;TextView .../&gt; &lt;TextView .../&gt; &lt;TextView .../&gt; &lt;/LinearLayout&gt; &lt;!-- 2nd child (2nd row)--&gt; ... &lt;/LinearLayout&gt; </code></pre> <p>Since the number of child linear layouts and their contents are quite dynamic, I've decide to add content to the root linear layout programmatically. </p> <p>How can the second layout be added to the first programmatically, which could also set all the layout attributes for each child and add more other elements inside child?</p>
    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.
 

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