0

here is my XML code which I am trying. I wrote the code in the right way but I can't get the results I want so please tell me where I am mistaken in coding thanks in advance for the help.

<ScrollView
        android:id="@+id/tabLOScroll"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:background="@color/toolBarClr"
        android:fillViewport="true"
        android:scrollbars="horizontal"
        android:orientation="horizontal"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/appBar">

        <LinearLayout
            android:id="@+id/tabLO"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:orientation="horizontal">

            <include
                layout="@layout/custome_tab_item"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="10dp"
                android:layout_marginEnd="20dp" />

            <include
                layout="@layout/custome_tab_item"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginEnd="20dp" />

            <include
                layout="@layout/custome_tab_item"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginEnd="20dp" />

            <include
                layout="@layout/custome_tab_item"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginEnd="20dp" />

            <include
                layout="@layout/custome_tab_item"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginEnd="20dp" />
        </LinearLayout>

    </ScrollView>

this just shows 4 tabs but I add 5 I want to scroll to see the 5th but the horizontal scroll not working

David Wasser
  • 93,459
  • 16
  • 209
  • 274
  • Removed tag `android-studio` as that tag is used for questions related to the Android Studio product. Your question has nothing to do with Android Studio. – David Wasser Sep 05 '22 at 10:25
  • possible duplicate : https://stackoverflow.com/questions/18656949/how-to-implement-horizontalscrollview-like-gallery – Akash Jain Sep 05 '22 at 10:32

1 Answers1

0

ScrollView supports vertical scrolling only. If you want horizontal scrolling, you need to use HorizontalScrollView. The documentation for ScrollView actually says exactly this.

David Wasser
  • 93,459
  • 16
  • 209
  • 274