多行表格布局跨度 [英] Table layout span across multiple rows

查看:169
本文介绍了多行表格布局跨度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的布局和我想的形象在2个行跨越,使2个按钮均位于其左侧。我想不出如何做到这一点,我还没有找到的Andr​​oid相当于:layout_span的行

此外我的按钮都应该显示PNG作为backgroundbut他们每56Px ...

显示比预期的56Px更大

谁能帮助我吗?

 < TableLayout
机器人:ID =@ + ID / TableLayout01
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:stretchColumns =0>  <的TableRow
  机器人:ID =@ + ID / TableRow01
  机器人:layout_width =WRAP_CONTENT
  机器人:layout_height =WRAP_CONTENT>  <按钮机器人:ID =@ + ID / btn_www
  机器人:背景=@绘制/ iconeweb
  机器人:layout_width =56px
  机器人:layout_height =56px/>  < ImageView的机器人:ID =@ + ID / image_gpe
  机器人:layout_width =200dip
  机器人:layout_height =175dip/>
  < /&的TableRow GT;<的TableRow
 机器人:ID =@ + ID / TableRow02
 机器人:layout_width =WRAP_CONTENT
 机器人:layout_height =WRAP_CONTENT> <按钮机器人:ID =@ + ID / btn_vid
  机器人:背景=@绘制/ iconecam
  机器人:layout_width =56px
  机器人:layout_height =56px/>
< /&的TableRow GT;
< / TableLayout>


解决方案

使用RelativeLayout的,使用 DP 而不是像素结果
下面调整您的要求code:

 < RelativeLayout的
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =WRAP_CONTENT>    <按钮
        机器人:ID =@ + ID / btn_www
        机器人:背景=@绘制/ iconeweb
        机器人:layout_width =56dp
        机器人:layout_height =56dp/>    <按钮
        机器人:ID =@ + ID / btn_vid
        机器人:背景=@绘制/ iconecam
        机器人:layout_below =@ ID / btn_www
        机器人:layout_width =56dp
        机器人:layout_height =56dp/>    < ImageView的
        机器人:ID =@ + ID / image_gpe
        机器人:layout_alignParentRight =真
        机器人:layout_toRightOf =@ ID / btn_www
        机器人:layout_width =200dip
        机器人:layout_height =175dip/>< / RelativeLayout的>

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: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>

这篇关于多行表格布局跨度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆