Spaces between texts in listview android -


i have 3 textviews in listview rows.
want space them equally. tried working gravity, isn't working.
spaces provided should equally distributed among texts or can vary.

below code:

list.xml

<listview     android:layout_width="wrap_content"     android:layout_height="457dp"     android:id="@+id/payment_plan_list_view"     android:layout_gravity="left|center"     android:divider="@android:color/transparent"     android:dividerheight="20dp"     android:layout_margintop="10dp"     android:layout_weight="3"      /> 

list_item.xml

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">  <tablelayout     android:layout_width="match_parent"     android:layout_height="wrap_content">      <tablerow>          <textview             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:textsize="15dp"             android:text="new text"             android:layout_gravity="left|center"             android:id="@+id/sr_no"             android:layout_weight="3"             />          <textview             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:textsize="15dp"             android:text="new text"             android:layout_gravity="left|center"             android:id="@+id/stage"             android:layout_weight="3"              />          <textview             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:textsize="15dp"             android:text="new text"             android:layout_gravity="left|center"             android:id="@+id/percentage"             android:layout_weight="3"              />     </tablerow>     </tablelayout> 

try using layout this:

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent" android:weightsum="1">          <textview             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:textsize="15dp"             android:text="new text"             android:layout_gravity="left|center"             android:id="@+id/sr_no"             android:layout_weight="0.35"             android:singleline="true"             android:padding="5dp" />          <textview             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:textsize="15dp"             android:text="new text"             android:layout_gravity="left|center"             android:id="@+id/stage"             android:layout_weight="0.35"              android:singleline="true"             android:padding="5dp" />          <textview             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:textsize="15dp"             android:text="new text"             android:layout_gravity="left|center"             android:id="@+id/percentage"             android:layout_weight="0.30"              android:singleline="true"             android:padding="5dp" />  </linearlayout> 

hope helps..


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -