On-screen buttons, input fields, laid out on LinearLayout, 2 gridview, the contents of which does not fit into the screen. All this is in ScrollView. Tell me how to make the scrollbar appear not in every gridview, but on the screen as a whole.

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".Multiplication" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/Stroki" /> <Spinner android:id="@+id/spinner1" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/Stolb" /> <Spinner android:id="@+id/spinner2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Заполнить матрицу" /> <Button android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Отобразить" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/llMain" android:orientation="vertical" > </LinearLayout> <GridView android:id="@+id/gridView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:numColumns="3" > </GridView> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Введите число" /> <EditText android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:ems="10" android:inputType="numberDecimal" > <requestFocus /> </EditText> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Умножить" /> </LinearLayout> <GridView android:id="@+id/gridView2" android:layout_width="match_parent" android:layout_height="wrap_content" android:numColumns="3" > </GridView> </LinearLayout> </ScrollView> 

    2 answers 2

    In general, it is not right to put Scroll in Scroll ...
    But there are situations when without it nothing ...
    I did this for myself: I calculate the sum of the height of all the elements of the inner scroll, and set it to the height.
    I specifically did this with a ListView nested in ScrollView

    • thanks for the idea. The height of all the elements is there, do not tell me how to set the height of the inner scroll. I can not find (( - Olga __

    Wrap both GridViews in ScrollView

    UPD Try swapping your first LinearLayout and ScrollView. I think it would be more correct.

    • ... or both in LinearLayout, and LinearLayout in ScrollView - Gorets
    • Everything is in ScrollView and the scrollbar appears only in the gridview - Olga__
    • show the code - Gorets
    • changed, the scroll bar appears on each GridView, you can see two lines, the rest have to scroll even when the content, in theory, fits ie the place still remains below. - Olga __
    • according to the idea of ​​the grid and should have their own scroll bars. And its elements do not exactly scroll? - DroidAlex