【问题标题】:Scroll in TableLayout在 TableLayout 中滚动
【发布时间】:2013-10-02 05:44:28
【问题描述】:

我想放一个垂直的ScrollView 我已经插入了我尝试过各种方式的表格但是它给了我错误,希望你能帮助我,问候。 我的 xml:

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

    <TableLayout
        android:id="@+id/LayoutTabla"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/spinnerDatos"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="39dp" >

        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1" >
        </TableRow>

        <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1" >
        </TableRow>

        <TableRow
            android:id="@+id/tableRow3"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1" >
        </TableRow>

        <TableRow
            android:id="@+id/tableRow4"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1" >
        </TableRow>


            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical" >
            </LinearLayout>

    </TableLayout>

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/btnVer"
        android:layout_alignBottom="@+id/btnVer"
        android:layout_alignParentLeft="true"
        android:text="Ver datos de" />

    <Spinner
        android:id="@+id/spinnerDatos"
        android:layout_width="125dp"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true" />

    <Button
        android:id="@+id/btnVer"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/LayoutTabla"
        android:layout_alignParentRight="true"
        android:layout_toRightOf="@+id/spinnerDatos"
        android:onClick="verTablaDatos"
        android:text="Ver" />

</RelativeLayout>

我只想把滚动条放到&lt;TableLayout&gt; 请帮帮我!

【问题讨论】:

    标签: android scrollview tablelayout


    【解决方案1】:

    尝试将 TableLayout 封装在:

    <ScrollView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:scrollbars="none"
    android:layout_weight="1">
    
        <TableLayout
        android:id="@+id/LayoutTabla"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/spinnerDatos"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="39dp" >
    

    【讨论】:

    • 现在的问题是滚动不仅完全下降,直到 TableLayout 到达屏幕顶部,你知道吗? ,这是为什么呢?
    • 不确定你的意思。你的意思是看不到整个布局?
    • 我的问题是我有一个动态获取数据的表格布局,即没有固定大小。该失败并未完全向下滚动。看不到整个表格。
    猜你喜欢
    • 1970-01-01
    • 2013-08-17
    • 2015-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-10
    • 1970-01-01
    相关资源
    最近更新 更多