csh_34 2012-09-18 09:03 采纳率: 0%
浏览 3320
已结题

在Android中如何实现下面这个布局?

data1    hello   hi 
data2    hello2  hi
data3    hi      Hello

我想知道用TableLayout还是linearLayout或者RelativeLayout,哪一个视图可以很好的实现这个布局?我也想用xml代码实现这个布局,请求各位支招,万分感谢!

  • 写回答

4条回答 默认 最新

  • myc_100 2012-09-18 09:44
    关注

    给出这段代码,看看能否实现想要的布局:

     <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical" android:layout_width="fill_parent"
     android:layout_height="fill_parent">
    <TableLayout android:layout_width="fill_parent"
     android:layout_height="wrap_content">
     <TableRow android:weightSum="3">
     <TextView android:layout_weight="1" android:layout_width="wrap_content"
     android:layout_height="wrap_content" android:text="hello" />
    <TextView android:layout_weight="1" android:layout_width="wrap_content"
     android:layout_height="wrap_content" android:text="hello" />
    <TextView android:layout_weight="1" android:layout_width="wrap_content"
     android:layout_height="wrap_content" android:text="hello" />
    </TableRow>
    <TableRow android:weightSum="3">
    <TextView android:layout_weight="1" android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="hello" />
    <TextView android:layout_weight="1" android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="hello" />
    <TextView android:layout_weight="1" android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="hello" />
    </TableRow>
    <TableRow android:weightSum="3">
    <TextView android:layout_weight="1" android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="hello" />
    <TextView android:layout_weight="1" android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="hello" />
    <TextView android:layout_weight="1" android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="hello" />
    </TableRow>
    </TableLayout>
    </LinearLayout>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 服务器一块硬盘重启过程中安装后,硬盘不识别了怎么修复?
  • ¥15 微信红包不拆包 知道红包金额
  • ¥15 0基础学机器人运动控制要多久?
  • ¥15 .net core 怎么进行中英文转换
  • ¥15 数学的三元一次方程求解
  • ¥20 iqoo11 如何下载安装工程模式
  • ¥15 本题的答案是不是有问题
  • ¥15 关于#r语言#的问题:(svydesign)为什么在一个大的数据集中抽取了一个小数据集
  • ¥15 C++使用Gunplot
  • ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?