我怎样才能让我的布局,滚动水平和垂直方向? [英] How can I make my layout scroll both horizontally and vertically?

查看:116
本文介绍了我怎样才能让我的布局,滚动水平和垂直方向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是TableLayout。我需要有水平和垂直滚动此布局。默认情况下,我能够得到的观点,但水平滚动垂直滚动不工作。

I am using a TableLayout. I need to have both horizontal and vertical scrolling for this layout. By default I am able to get vertical scrolling in the view but horizontal scrolling is not working.

我使用的Andr​​oid SDK 1.5 R3。我已经尝试过机器人:滚动条=横向

I am using Android SDK 1.5 r3. I have already tried android:scrollbars="horizontal".

我看过一些论坛,在蛋糕的更新,水平滚动是可能的。

I have read on some forums that in the cupcake update, horizontal scrolling is possible.

我怎样才能让我的布局,滚动在两个方向?

How can I make my layout scroll in both directions?

推荐答案

我能找到一个简单的方法来实现这两个滚动的行为。

I was able to find a simple way to achieve both scrolling behaviors.

下面是XML吧:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:scrollbars="vertical">

    <HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="320px" android:layout_height="fill_parent">

        <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/linlay" android:layout_width="320px"
            android:layout_height="fill_parent" android:stretchColumns="1"
            android:background="#000000"/>

    </HorizontalScrollView>

</ScrollView>

这篇关于我怎样才能让我的布局,滚动水平和垂直方向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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