java - How to cause table cells to use all screen height in TableLayout? -


i new android development.
have activity in set few buttons in 2 table rows. use small portion of
here xml layout activity:

<?xml version="1.0" encoding="utf-8"?> <tablelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/tablelayout1"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:orientation="vertical" >       <tablerow         android:id="@+id/tablerow1"         android:layout_width="wrap_content"         android:layout_height="wrap_content" >          <button             android:id="@+id/button1"             android:layout_width="0dp"             android:layout_height="wrap_content"             android:layout_weight="1"             android:text="button" />          <button             android:id="@+id/button2"             android:layout_width="0dp"             android:layout_height="wrap_content"             android:layout_weight="1"             android:text="button" />          <button             android:id="@+id/button3"             android:layout_width="0dp"             android:layout_height="wrap_content"             android:layout_weight="1"             android:text="button" />     </tablerow>       <tablerow         android:id="@+id/tablerow2"         android:layout_width="wrap_content"         android:layout_height="wrap_content" >      </tablerow>      <tablerow         android:id="@+id/tablerow3"         android:layout_width="wrap_content"         android:layout_height="wrap_content" >     </tablerow>  </tablelayout> 

thanks help!

try use android:layout_weight="1" in table row

 <tablerow         android:id="@+id/tablerow1"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_weight="1"> 

see

<?xml version="1.0" encoding="utf-8"?> <tablelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/tablelayout1"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:orientation="vertical" >       <tablerow         android:id="@+id/tablerow1"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_weight="1"         android:background="#ffff0000">          <button             android:id="@+id/button1"             android:layout_width="0dp"             android:layout_height="fill_parent"             android:layout_weight="1"             android:text="button" />          <button             android:id="@+id/button2"             android:layout_width="0dp"             android:layout_height="fill_parent"             android:layout_weight="1"             android:text="button" />          <button             android:id="@+id/button3"             android:layout_width="0dp"             android:layout_height="fill_parent"             android:layout_weight="1"             android:text="button" />     </tablerow>       <tablerow         android:id="@+id/tablerow2"         android:layout_width="wrap_content"         android:layout_height="wrap_content"          android:layout_weight="1"           android:background="#ff00ff00">      </tablerow>      <tablerow         android:id="@+id/tablerow3"         android:layout_width="wrap_content"         android:layout_height="wrap_content"          android:layout_weight="1"           android:background="#ff00ff">     </tablerow>  </tablelayout> 

enter image description here


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -