制作水平和垂直可滚动版面

问题描述:

我试图使水平和垂直ScrollableLayout。我设法做出了水平或垂直可滚动的布局,但我无法在两面都做到这一点。制作水平和垂直可滚动版面

我试图把ScrollView放在HorizontalScrollView里面,但是当我这样做的时候它缩小了水平面。这里是我的代码:

<HorizontalScrollView 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

    <ScrollView 
     android:id="@+id/mainLayout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 


    </ScrollView> 

</HorizontalScrollView> 

我正在用java代码在ScrollView内添加我的视图。

+0

看到这个[问题](https://*.com/questions/2044775/scrollview-vertical-and-horizo​​ntal-in-android) – FarshidABZ

我相信标准库中没有任何东西可以实现你想要的功能。既然你在本页的某个地方发表了评论,你将在其中放置一个TableLayout,你可能会更好地服务于第三方组件,如TableFixHeaders

这段代码实际上为我工作:

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 
    <ScrollView 
     android:id="@+id/verticalScroll" 
     android:layout_width="match_parent" 
     android:scrollbars="horizontal|vertical" 
     android:layout_height="match_parent" 
     android:fillViewport="true"> 

     <HorizontalScrollView 
      android:id="@+id/mainLayout" 
      android:layout_width="wrap_content" 
      android:scrollbars="horizontal|vertical" 
      android:layout_height="wrap_content"> 


     </HorizontalScrollView> 

    </ScrollView> 

</LinearLayout>