【问题标题】:Horizontal and vertical scrollbar in Android with tablelayout?Android中带有tablelayout的水平和垂直滚动条?
【发布时间】:2011-05-10 05:32:21
【问题描述】:

如果您知道如何添加两个滚动条,请帮助我。
首先,我向所有人清楚。
我在表格布局中添加了两个滚动条,但主要问题是我使用动态数据来填充表格行。所以,如果只有一条记录,那么在数据之后水平滚动视图顶部。但我想在底部显示水平并显示垂直。


谢谢
普拉尚特

【问题讨论】:

  • 我想您是在问如何让水平滚动条一直显示在 TableLayout 的底部,而不是在数据下方。对吗?

标签: java android tablelayout


【解决方案1】:

使用此代码..

<ScrollView
android:id="@+id/scrllvwNo1"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
//TextView
//Button
</ScrollView>
</LinearLayout> 

【讨论】:

    【解决方案2】:

    我试过这种方式,它对我来说运行得很好。

    <ScrollView android:id="@+id/layout" android:layout_height="fill_parent"
        android:layout_alignParentBottom="true"
        android:scrollbars="horizontal|vertical" android:layout_width="fill_parent"
        android:layout_marginTop="50dip"
        android:scrollbarStyle="outsideInset">
    <HorizontalScrollView android:id="@+id/horizontalView" android:layout_height="fill_parent"
        android:scrollbars="horizontal|vertical" android:layout_width="wrap_content"
        android:layout_marginTop="50dip">
        <RelativeLayout android:layout_width="wrap_content"
            android:layout_height="wrap_content" android:id="@+id/RelativeLayout">
    
        <ImageView android:id="@+id/imgView" android:maxHeight="280dip"
                android:layout_marginLeft="20dip"   
                android:layout_marginTop="10dip"
                android:src="@drawable/ic_facebook" android:maxWidth="280dip"
                android:scaleType="centerInside"
                android:layout_height="280dip" 
                android:layout_width="280dip"></ImageView>
        </RelativeLayout>
    </HorizontalScrollView>
    

    【讨论】:

      【解决方案3】:

      【讨论】:

      • 但我无法得到正确的答案。请详细说明。