首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >TableRow内部的HorizontalScrollView

TableRow内部的HorizontalScrollView
EN

Stack Overflow用户
提问于 2011-11-10 01:50:28
回答 1查看 968关注 0票数 0

我在TableLayout中有一个TableRow。如果我在TableRow中放入一个垂直的ScrollView,它会按预期工作。但是,如果我在TableRow中放入一个HorizontalScrollView,滚动条就根本不能工作了。

有人知道为什么会这样吗?我可以使用任何解决方法来实现这一点吗?

提前感谢!

-编辑--

下面是一个示例:

代码语言:javascript
复制
<?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"
    android:orientation="vertical" >

    <TableRow>
        <HorizontalScrollView android:scrollbars="horizontal"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">

            <TableLayout android:layout_width="fill_parent" android:layout_height="fill_parent">

                <TableRow>
                    <Button android:layout_width="350px" android:layout_height="350px" android:text="TEST" />
                    <Button android:layout_width="350px" android:layout_height="350px" android:text="TEST" />
                </TableRow>
                <TableRow>
                    <Button android:layout_width="350px" android:layout_height="350px" android:text="TEST" />
                    <Button android:layout_width="350px" android:layout_height="350px" android:text="TEST" />
                </TableRow>
            </TableLayout>

        </HorizontalScrollView>

    </TableRow>

</TableLayout>

如果我将HorizontalScrollView更改为垂直的ScrollView,它就可以工作(显然是垂直的)。

EN

回答 1

Stack Overflow用户

发布于 2014-08-20 23:42:57

试一试

代码语言:javascript
复制
<HorizontalScrollView android:scrollbars="horizontal"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent">

编辑:

这应该将ScrollView设置为内容的大小(内容大小),而不是parrent中可用位置的大小。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8069290

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档