Table layout span across multiple rows
I have this layout and I would like the image to span across 2 rows, so that the 2 buttons are both located at its left. I can't figure how to do that and I have not yet found the equivalent of android:layout_span for rows.
Also my buttons are supposed to display a png as backgroundbut they are displayed much bigger than the expected 56Px per 56Px...
can anyone help me please ?
<TableLayout
android:id="@+id/TableLayout01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="0">
<TableRow
android:id="@+id/TableRow01"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button android:id="@+id/btn_www"
android:background="@drawable/iconeweb"
android:layout_width="56px"
android:layout_height="56px"/>
<ImageView android:id="@+id/image_gpe"
android:开发者_C百科layout_width="200dip"
android:layout_height="175dip"/>
</TableRow>
<TableRow
android:id="@+id/TableRow02"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button android:id="@+id/btn_vid"
android:background="@drawable/iconecam"
android:layout_width="56px"
android:layout_height="56px"/>
</TableRow>
</TableLayout>
Use RelativeLayout, use dp
instead of px
.
Adjust the code below to your requirements:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/btn_www"
android:background="@drawable/iconeweb"
android:layout_width="56dp"
android:layout_height="56dp" />
<Button
android:id="@+id/btn_vid"
android:background="@drawable/iconecam"
android:layout_below="@id/btn_www"
android:layout_width="56dp"
android:layout_height="56dp" />
<ImageView
android:id="@+id/image_gpe"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/btn_www"
android:layout_width="200dip"
android:layout_height="175dip" />
</RelativeLayout>
精彩评论