0

I am trying to make both horizantally and vertically ScrollableLayout. I managed to make horizantally or vertically scrollable layout but I couldn't make it for both side.

I tried to put ScrollView inside HorizontalScrollView but when I do that it shrinked horizontal side. Here is my code:

<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>

I am adding my views inside ScrollView with java code.

Arman Manucharyan
  • 237
  • 1
  • 4
  • 18
rawsly
  • 372
  • 1
  • 5
  • 20
  • see this [question](https://stackoverflow.com/questions/2044775/scrollview-vertical-and-horizontal-in-android) – FarshidABZ Nov 25 '17 at 11:44

2 Answers2

0

I believe there is nothing in the standard library that does what you want. Since you said in a comment somewhere on this page that you are going to put a TableLayout inside, you'll probably be better served by some third-party component such as TableFixHeaders.

Giulio Piancastelli
  • 15,368
  • 5
  • 42
  • 62
0

This code actually worked for me:

<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>
rawsly
  • 372
  • 1
  • 5
  • 20