如何让我的布局水平和垂直滚动? [英] How can I make my layout scroll both horizontally and vertically?

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

问题描述

我正在使用 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.

我使用的是 Android SDK 1.5 r3.我已经尝试过 android:scrollbars="horizo​​ntal".

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 
        android:layout_width="320px" android:layout_height="fill_parent">

        <TableLayout
            android:id="@+id/linlay" android:layout_width="320px"
            android:layout_height="fill_parent" android:stretchColumns="1"
            android:background="#000000"/>

    </HorizontalScrollView>

</ScrollView>

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

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