【问题标题】:Setting 3 textviews in a TableRow with only 2 columns - Android在只有 2 列的 TableRow 中设置 3 个文本视图 - Android
【发布时间】:2013-01-10 23:24:16
【问题描述】:

我正在尝试在TableLayout 中创建一个TableRow:

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

希望这是有道理的。我正在尝试将 3 个TextViews 放入一个TableRow。第一列将包含多行和宽 TextView,而第二列将包含 2 个单行短 TextViews,它们将相互堆叠。

这可能吗?如果没有,我将如何实现这一目标?下面是我已经启动的xml代码。

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

【问题讨论】:

    标签: android xml textview tablelayout tablerow


    【解决方案1】:
    <TableLayout>
     <TableRow>
      Multiline Text
      <TableLayout>
       <TableRow>
        Text
       </TableRow>
       <TableRow>
        Text
      </TableRow>
      </TableLayout>
     </TableRow>
    </TableLayout>
    

    【讨论】:

    • 所以第 2 列/第 1 行需要是一个 TableLayout,其中 TableLayout 包含 2 行?杰出的! :) 谢谢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-23
    • 1970-01-01
    • 2016-08-08
    • 2023-03-18
    • 2010-11-11
    相关资源
    最近更新 更多