Jump to content

TableLayout et cases de même dimension


Bertrand31

Recommended Posts

Salut,

J'aimerai savoir comment faire pour avoir un tableau de 2x2 avec des cases de dimensions fixes et égales. (cf pièce jointe )

J'arrive à obtenir quelque chose de bien lorsque les cases sont vides, mais dès que j'y introduit quelque chose, les dimensions "éclatent"...

Voici mon code

<?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:background="#FFF"
 android:orientation="vertical">

<LinearLayout
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:background="@drawable/cadre2"
  android:gravity="center">
  	<TextView android:layout_width="fill_parent"
  		android:layout_height="wrap_content"
  		 android:gravity="center"
  		android:text="TEXTE HAUT"/>
  </LinearLayout>

  <TableLayout 
  	android:id="@+id/TableLayout01"
	android:layout_width="fill_parent"
	android:layout_height="fill_parent"
	android:layout_weight="1"
	android:background="@drawable/cadre2"
	android:layout_marginTop="2dp"
	android:layout_marginBottom="2dp"
	android:padding="5dip"
	android:stretchColumns="*">

  	<TableRow android:layout_weight="1">	
  		<ImageView 
  			android:id="@+id/ImageView01"
  			android:layout_width="fill_parent"
  			android:layout_height="fill_parent" 
  			android:background="@drawable/cadre2" 
  			android:adjustViewBounds="true" 
  			android:scaleType="fitCenter" >
  		</ImageView>
		<LinearLayout
			android:layout_width="fill_parent"
  			android:layout_height="fill_parent"
  			android:background="@drawable/cadre2" 
  			android:orientation="vertical">					
  		</LinearLayout>
  	</TableRow> 

  	<TableRow android:layout_weight="1">
  		<LinearLayout
			android:layout_width="fill_parent"
  			android:layout_height="fill_parent"
  			android:background="@drawable/cadre2" 
  			android:orientation="vertical">
  		</LinearLayout>	
       	<LinearLayout
			android:layout_width="fill_parent"
  			android:layout_height="fill_parent"
  			android:background="@drawable/cadre2" 
  			android:orientation="vertical">
  		</LinearLayout>	
  	</TableRow> 	
  </TableLayout>

 <LinearLayout
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:background="@drawable/cadre2"
  android:gravity="center"
  android:paddingTop="10dp"
  android:paddingBottom="10dp">
  	<TextView android:layout_width="fill_parent"
  		android:layout_height="wrap_content"
  		 android:gravity="center"
  		android:text="TEXTE BAS"/> 
</LinearLayout>


</LinearLayout>

Merci!

Link to comment
Share on other sites

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...