2011-08-30 57 views
1

如何水平设置ScrollView垂直&?我尝试了下面的代码,但没有奏效。在TableLayout中使用ScrollView&Horizo​​ntalScrollView

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:scrollbarFadeDuration="1000" 
     android:scrollbarSize="12dip" 
     android:background="@color/red" > 

     <HorizontalScrollView android:id="@+id/horizontalScrollView1" android:layout_width="wrap_content" android:layout_height="wrap_content"> 
      <TableLayout android:layout_width="match_parent" android:layout_marginTop="10dp" android:id="@+id/tableLayout1" android:layout_height="wrap_content" android:stretchColumns="1" android:collapseColumns="2"> 

      </TableLayout> 
     </HorizontalScrollView> 
</ScrollView> 

这是我的所有代码:http://pastebin.com/ysRhLMyt

回答

1

尝试,

设置机器人:scrollbarFadeDuration = “0”

 OR 

ScrollView1.setScrollbarFadingEnabled(假);

 OR 

机器人:scrollbarFadeDuration = “0” 和

机器人:scrollbarAlwaysDrawVerticalTrack = “真正的” 垂直

机器人:scrollbarAlwaysDrawHorizo​​ntalTrack = “真” 的水平

还有一件事,请记住,ScrollView只能有一个子控件,所以我们可以创建一个容器(Linear,relative,Table)布局)ScrollView的孩子,并把这个孩子的所有控制。

参考:http://android-pro.blogspot.com/2010/02/android-scrollview.html

TableLayout ScrollView Vertical & Horizontal

0

线性布局(@ + ID/linearLayout3)取向是水平的,使其垂直的,使得在下面示出的内容。我认为目前,您的列表分隔线和列表项目在屏幕上水平添加,而不是垂直添加。

1

尝试改变ScrollView的高度"fill_parent"

1

如果要水平移动行,那么我建议像

滚动型父,表格布局作为其唯一的孩子设计你的布局,然后将表中的行添加到表格的布局,把每个表格行内的horizo​​ntalscrollview。通过这种方式,您可以垂直移动工作台并水平移动工作台中的行。

希望这有助于。

+0

根据您的建议,它会在每一行显示水平滚动条?是吗? – Piraba

+0

是的,如果不需要,你总是可以禁用滚动条。 –

相关问题