Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid: merging components in 2 tablerows vertically
    primarykey
    data
    text
    <p>Suppose I am having a layout xml as follows:</p> <p>TableLayout</p> <pre><code>Row0: | textView_title (width=9) | Row1: | ButtonX(width=3) | textView_describe (width=6) | Row2: | ButtonY(width=3) | Button_back(width=3)| Button_start(width=3)| </code></pre> <p>Merging horizontally can use the technique of span just like in below coding. I would like to ask is it possible to merge ButtonX and ButtonY? (i.e. vertically?), if not, are there any methods to make such a layout?</p> <p>Many thanks!!</p> <h2>Coding:</h2> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:stretchColumns="*" android:screenOrientation="landscape" android:background="@drawable/blackboard" &gt; &lt;TableRow android:id="@+id/tableRow0" android:layout_weight="0.2" android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;TextView android:id="@+id/textview_title" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_margin="2dp" android:background="@drawable/transparent_btn" android:gravity="center" android:layout_span="9" android:text="@string/title_number" android:textColor="@color/white" android:textSize="60dp" /&gt; &lt;/TableRow&gt; &lt;TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:layout_weight="0.5" android:gravity="center" &gt; &lt;Button android:id="@+id/buttonX" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="2dp" android:layout_span="3" android:background="@drawable/transparent_btn" android:text="" android:textSize="30dp" /&gt; &lt;TextView android:id="@+id/text_describe" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="2dp" android:layout_span="6" android:background="@drawable/white_dot_btn" android:gravity="top" android:onClick="button_start_click" android:text="abc" android:textColor="@color/white" android:textSize="20dp" /&gt; &lt;/TableRow&gt; &lt;TableRow android:id="@+id/tableRow2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:layout_weight="0.3" android:gravity="center" &gt; &lt;Button android:id="@+id/buttonY" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="2dp" android:layout_span="3" android:background="@drawable/transparent_btn" android:text="" android:textSize="30dp" /&gt; &lt;Button android:id="@+id/button_back" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="2dp" android:layout_span="3" android:background="@drawable/white_btn" android:text="quit" android:onClick="button_back_click" android:textSize="30dp" /&gt; &lt;Button android:id="@+id/button_start" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="2dp" android:layout_span="3" android:background="@drawable/green_btn" android:text="start" android:onClick="button_start_click" android:textSize="30dp" /&gt; &lt;/TableRow&gt; &lt;/TableLayout&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.
 

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