tablelayout - Fixed height of tableRow Android -


i have calendar contains tablelayout 6 rows, each row contains 6 cells of type cellulemensuelle (it extends linearlayout).

in beginning, rows have same height, when add textviews cell, increases height of row, how can prevent ? want rows keep initial height

here xml file calendrier_calendriermensuel.xml

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" >  <linearlayout     android:layout_width="match_parent"     android:layout_height="wrap_content">     <textview        android:layout_width="0dp"        android:layout_height="wrap_content"        android:layout_weight="3"                                   android:text="lundi"        android:background="@drawable/ligne_bordure"     />     <textview        android:layout_width="0dp"        android:layout_height="wrap_content"        android:layout_weight="3"                                   android:text="mardi"        android:background="@drawable/ligne_bordure"     />     <textview        android:layout_width="0dp"        android:layout_height="wrap_content"        android:layout_weight="3"                                   android:text="mercredi"        android:background="@drawable/ligne_bordure"     />     <textview        android:layout_width="0dp"        android:layout_height="wrap_content"        android:layout_weight="3"                                   android:text="jeudi"        android:background="@drawable/ligne_bordure"     />     <textview        android:layout_width="0dp"        android:layout_height="wrap_content"        android:layout_weight="3"                                   android:text="vendredi"        android:background="@drawable/ligne_bordure"      /> </linearlayout>  <tablelayout     android:id="@+id/layout_calendriermensuel"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:layout_weight="1"     android:background="#ffffff">      <tablerow         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="1">          <com.thinline.dm21.utils.cellulemensuelle           android:layout_width="0dp"           android:layout_height="match_parent"           android:layout_weight="1"           android:background="@drawable/ligne_bordure"         />         <com.thinline.dm21.utils.cellulemensuelle           android:layout_width="0dp"           android:layout_height="match_parent"           android:layout_weight="1"           android:background="@drawable/ligne_bordure"         />         <com.thinline.dm21.utils.cellulemensuelle           android:layout_width="0dp"           android:layout_height="match_parent"           android:layout_weight="1"           android:background="@drawable/ligne_bordure"         />         <com.thinline.dm21.utils.cellulemensuelle           android:layout_width="0dp"           android:layout_height="match_parent"           android:layout_weight="1"           android:background="@drawable/ligne_bordure"         />         <com.thinline.dm21.utils.cellulemensuelle           android:layout_width="0dp"           android:layout_height="match_parent"           android:layout_weight="1"           android:background="@drawable/ligne_bordure"         />                                       </tablerow>     <tablerow         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="1">          <com.thinline.dm21.utils.cellulemensuelle           android:layout_width="0dp"           android:layout_height="match_parent"           android:layout_weight="1"           android:background="@drawable/ligne_bordure"         />         <com.thinline.dm21.utils.cellulemensuelle           android:layout_width="0dp"           android:layout_height="match_parent"           android:layout_weight="1"           android:background="@drawable/ligne_bordure"         />         <com.thinline.dm21.utils.cellulemensuelle           android:layout_width="0dp"           android:layout_height="match_parent"           android:layout_weight="1"           android:background="@drawable/ligne_bordure"         />         <com.thinline.dm21.utils.cellulemensuelle           android:layout_width="0dp"           android:layout_height="match_parent"           android:layout_weight="1"           android:background="@drawable/ligne_bordure"         />         <com.thinline.dm21.utils.cellulemensuelle           android:layout_width="0dp"           android:layout_height="match_parent"           android:layout_weight="1"           android:background="@drawable/ligne_bordure"         />                                       </tablerow>      <!-- 4 others tablerows --!> </tablelayout>  </linearlayout> 

you need set android:weightsum attribute of tablelayout, if have 6 rows , want keep same height them , each of row has attribute weight set 1, android:weightsum attribute of tablelayout needs 6.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -