java 带有表格布局的Android中的水平和垂直滚动条?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4184536/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Horizontal and vertical scrollbar in Android with tablelayout?
提问by PrashantAdesara
Please help me if you know how to add both scrollbar.
First of all i clear to all.
I added both scroll bar in tablelayout but main problem is i m using dynamic data for filling tablerow. So, if there is only one record so horizontal scroll view top after the data. but i want to show horizontal in bottom and also show vertical.
如果您知道如何添加两个滚动条,请帮助我。
首先我很清楚。
我在 tablelayout 中添加了两个滚动条,但主要问题是我使用动态数据填充 tablerow。所以,如果只有一条记录那么水平滚动查看top之后的数据。但我想在底部显示水平并显示垂直。
Thanks
Prashant
由于
PRASHANT
回答by sanjay
Use this code..
使用此代码..
<ScrollView
android:id="@+id/scrllvwNo1"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
//TextView
//Button
</ScrollView>
</LinearLayout>
回答by PrashantAdesara
I tried this way and its run perfectly for me.
我试过这种方式,它对我来说非常完美。
<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>
回答by PrashantAdesara
Use the attribute scrollbarAlwaysDrawHorizontalTrack
respectively scrollbarAlwaysDrawVerticalTrack
scrollbarAlwaysDrawHorizontalTrack
分别使用属性scrollbarAlwaysDrawVerticalTrack
Here the documentation:
这里的文档: