设置3 textviews在的TableRow只有2列 - Android电子 [英] Setting 3 textviews in a TableRow with only 2 columns - Android

查看:185
本文介绍了设置3 textviews在的TableRow只有2列 - Android电子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让的TableRow TableLayout 像这样:

  _____________________________________
               | ___________________ ____________ |
               | | TextView的1 | | TextView的2 | |
               | | | | ___________ | |
               | | | ___________ |
               | | | | TextView的3 | |
               | | ___________________ | | ___________ | |
               | _____________________________________ |

希望这是有道理的。我试图把3 TextViews 到一个的TableRow 。第一列将包含多行和宽的TextView ,而第二列将包含2单行短 TextViews 即会被堆叠在彼此的顶部上。

这是可能的吗?如果没有,我怎么会去实现呢?下面是XML code我已经开始。

 < TableLayout
    的xmlns:工具=htt​​p://schemas.android.com/tool​​s
    的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:方向=垂直
    机器人:layout_height =FILL_PARENT
    机器人:layout_width =FILL_PARENT>    <的TableRow
        机器人:ID =@ + ID / ROW1
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =WRAP_CONTENT>        <的TextView
            机器人:ID =@ + ID /问题
            机器人:layout_height =WRAP_CONTENT
            机器人:layout_width =WRAP_CONTENT
            机器人:文字样式=大胆
            机器人:TEXTSIZE =8SP/>        <的TextView
            机器人:ID =@ + ID /计时器
            机器人:layout_height =WRAP_CONTENT
            机器人:layout_width =WRAP_CONTENT
            机器人:文字样式=大胆
            机器人:TEXTSIZE =8SP/>        <的TextView
            机器人:ID =@ + ID /点
            机器人:layout_height =WRAP_CONTENT
            机器人:layout_width =WRAP_CONTENT
            机器人:文字样式=大胆
            机器人:TEXTSIZE =8SP/>
    < /&的TableRow GT;
< / TableLayout>


解决方案

 < TableLayout>
 <&的TableRow GT;
  多行文字
  < TableLayout>
   <&的TableRow GT;
    文本
   < /&的TableRow GT;
   <&的TableRow GT;
    文本
  < /&的TableRow GT;
  < / TableLayout>
 < /&的TableRow GT;
< / TableLayout>

I am trying to make a TableRow in a TableLayout as so:

                _____________________________________
               |  ___________________   ____________ |
               | |TEXTVIEW 1         | |TEXTVIEW 2 | |
               | |                   | |___________| |
               | |                   |  ___________  |
               | |                   | |TEXTVIEW 3 | |
               | |___________________| |___________| |
               |_____________________________________|

Hopefully that makes sense. I am trying to put 3 TextViews into one TableRow. The first column will contain a multiline and wide TextView while the second column will contain 2 single-line short TextViews that will be stacked on top of each other.

Is this possible to do? If not, how would I go about accomplishing this? Below is the xml code I have started.

<TableLayout
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" 
    android:layout_height="fill_parent" 
    android:layout_width="fill_parent" > 

    <TableRow
        android:id="@+id/row1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >

        <TextView 
            android:id="@+id/question"
            android:layout_height="wrap_content" 
            android:layout_width="wrap_content"  
            android:textStyle="bold"
            android:textSize="8sp" />

        <TextView
            android:id="@+id/timer"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:textStyle="bold"
            android:textSize="8sp" />

        <TextView
            android:id="@+id/points"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:textStyle="bold"
            android:textSize="8sp" /> 
    </TableRow>
</TableLayout>

解决方案

<TableLayout>
 <TableRow>
  Multiline Text
  <TableLayout>
   <TableRow>
    Text
   </TableRow>
   <TableRow>
    Text
  </TableRow>
  </TableLayout>
 </TableRow>
</TableLayout>

这篇关于设置3 textviews在的TableRow只有2列 - Android电子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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