android - Issue with spacing using TableLayout and TableRow -


i have following setup in xml file:

<tablelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/table_more_features"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:background="@color/background_blue" >     ... <tablerow         android:id="@+id/tablerow7"         android:layout_width="fill_parent"         android:layout_height="fill_parent"         android:background="@drawable/cell_top"         android:padding="5dip" >          <textview             android:id="@+id/txt_foo"             android:background="@android:color/transparent"             android:layout_weight=".3"             android:text="foo" />          <textview             android:id="@+id/txt_bar"             android:background="@android:color/transparent"             android:layout_weight=".3"             android:text="bar" />          <textview             android:id="@+id/txt_woo"             android:background="@android:color/transparent"             android:layout_weight=".3"             android:text="woo" />     </tablerow> ... </tablelayout> 

the result looks this

seems no matter try cannot spacing between 3 textviews, first takes majority of room. trying have 3 spaced evenly horizontally.

thanks help.

though in code spaces out evenly try following:

  • to each textview add android:layout_width="0dp"
  • (optional) table row add android:weightsum="1"

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -