android - how to fill the remaining screen with table -


i have following layout in application layout ok, quit buttons not there.

now want distribute space after textview , table of 3 rows having 0-9,c, d buttons. want 3 rows span remaining space equally.

please tell me how it. posting xml code.

<?xml version="1.0" encoding="utf-8"?>  <relativelayout  xmlns:android="http://schemas.android.com/apk/res/android"   android:id="@+id/main_layout"  android:layout_width="fill_parent"  android:layout_height="fill_parent"  android:layout_gravity="center_vertical" >   <edittext     android:id="@+id/textview1"     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:layout_margintop="10dp"     android:focusable="false"     android:focusableintouchmode="false"     android:inputtype="text"     android:maxlength="100" />  <tablelayout     android:id="@+id/table"     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:layout_below="@id/textview1"     android:layout_margintop="20dp"     android:stretchcolumns="*" >      <tablerow>           <button             android:id="@+id/btn0"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_weight=".25"             android:clickable="true"             android:focusable="true"             android:focusableintouchmode="true"             android:gravity="center"             android:text="0"             android:textsize="10pt"             android:visibility="visible" />          <button             android:id="@+id/btn1"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_weight=".25"             android:clickable="true"             android:focusable="true"             android:focusableintouchmode="true"             android:gravity="center"             android:text="1"             android:textsize="10pt"             android:visibility="visible" />          <button             android:id="@+id/btn2"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_weight=".25"             android:clickable="true"             android:focusable="true"             android:focusableintouchmode="true"             android:gravity="center"             android:text="2"             android:textsize="10pt"             android:visibility="visible" />          <button             android:id="@+id/btn3"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_weight=".25"             android:clickable="true"             android:focusable="true"             android:focusableintouchmode="true"             android:gravity="center"             android:text="3"             android:textsize="10pt"             android:visibility="visible" />     </tablerow>      <view         android:layout_height="2dip"         android:background="#ff909090" />      <tablerow>          <button             android:id="@+id/btn4"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_weight=".25"             android:clickable="true"             android:focusable="true"             android:focusableintouchmode="true"             android:gravity="center"             android:text="4"             android:textsize="10pt"             android:visibility="visible" />          <button             android:id="@+id/btn5"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_weight=".25"             android:clickable="true"             android:focusable="true"             android:focusableintouchmode="true"             android:gravity="center"             android:text="5"             android:textsize="10pt"             android:visibility="visible" />          <button             android:id="@+id/btn6"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_weight=".25"             android:clickable="true"             android:focusable="true"             android:focusableintouchmode="true"             android:gravity="center"             android:text="6"             android:textsize="10pt"             android:visibility="visible" />          <button             android:id="@+id/btn7"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_weight=".25"             android:clickable="true"             android:focusable="true"             android:focusableintouchmode="true"             android:gravity="center"             android:text="7"             android:textsize="10pt"             android:visibility="visible" />     </tablerow>      <view         android:layout_height="2dip"         android:background="#ff909090" />      <tablerow>          <button             android:id="@+id/btn8"             android:layout_width="0px"             android:layout_height="wrap_content"             android:layout_weight=".25"             android:clickable="true"             android:focusable="true"             android:focusableintouchmode="true"             android:gravity="center"             android:text="8"             android:textsize="10pt"             android:visibility="visible" />          <button             android:id="@+id/btn9"             android:layout_width="0px"             android:layout_height="wrap_content"             android:layout_weight=".25"             android:clickable="true"             android:focusable="true"             android:focusableintouchmode="true"             android:gravity="center"             android:text="9"             android:textsize="10pt"             android:visibility="visible" />           <button             android:id="@+id/btn10"             android:layout_width="0px"             android:layout_height="wrap_content"             android:layout_weight=".25"             android:clickable="true"             android:focusable="true"             android:focusableintouchmode="true"             android:gravity="center"             android:text="clear"             android:textsize="10pt"             android:visibility="visible" />       </tablerow> </tablelayout>  <view     android:id="@+id/view1"     android:layout_width="fill_parent"     android:layout_height="90dp"     android:layout_below="@id/table" > </view>    </relativelayout> 

i build relativelayouts bottom , top down. here example of do. butons @ bottom , i'll place above height fill_parent -- has been working me.

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/layout"     android:layout_width="fill_parent"     android:layout_height="fill_parent" >      <linearlayout         android:id="@+id/buttons"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:layout_alignparentbottom="true"         android:layout_centerhorizontal="true"         android:orientation="horizontal" >          <button             android:id="@+id/btn1"             android:layout_width="fill_parent"             android:layout_height="wrap_content" />          <button             android:id="@+id/btn2"             android:layout_width="fill_parent"             android:layout_height="wrap_content" />     </linearlayout>      <scrollview         android:id="@+id/scroll"         android:layout_width="fill_parent"         android:layout_height="fill_parent"         android:layout_above="@id/buttons" >          ....      </scrollview>  </relativelayout> 

Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -