【问题标题】:Creating a two column Activity with horizontal and vertical scrolling [closed]创建具有水平和垂直滚动的两列活动[关闭]
【发布时间】:2012-08-03 11:58:56
【问题描述】:

我正在尝试在 Android 中使用垂直和水平滚动制作两列 <TableLayout>

像这样:

这是我的代码:

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <TableRow
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:weightSum="1.0" >

       <LinearLayout
           android:layout_width="match_parent"
           android:layout_height=".90"
           android:layout_gravity="left"
           android:layout_weight=".35" >

            <TextView
                android:id="@+id/TextView04"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="#b0b0b0"
                android:text="column 1"
                android:textColor="#000000" />

        </LinearLayout> 

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_gravity="right"
            android:layout_weight=".65" > 

            <TextView
                android:id="@+id/TextView03"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:background="#a09f9f"
                android:text="column 2"
                android:textColor="#000000" />
        </LinearLayout>
    </TableRow>

</TableLayout>

也许有人可以帮助我编写所有代码?

【问题讨论】:

  • 抱歉,这不是“请提供 codez”网站...

标签: android xml android-layout android-tablelayout


【解决方案1】:

Android -- How to allow horizontal and vertical scrolling

所以你需要 4 个滚动视图。 2 个水平和 2 个垂直。

<LinearLayout>
<ScrollView>
<HorizontalScrollView >
Column1
</ScrollView>
</HorizontalScrollView >
<ScrollView>
<HorizontalScrollView >
Column2
</ScrollView>
</HorizontalScrollView >
</LinearLayout>

并且线性布局必须是水平的。

【讨论】:

    猜你喜欢
    • 2016-07-24
    • 2014-01-01
    • 2019-04-16
    • 1970-01-01
    • 2014-03-16
    • 1970-01-01
    • 2014-01-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多