Horizontal scroll view with child TextViews not scrolling





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I am showing the user some stats. There is a lot of information on the screen so space is cramped. I decided to use a horizontal scroll view which contains 9 TextViews in total. However, I only want to display three of these text views at a time.



Like so:



scroll



(The arrow is a just separate image view that just show's the user they can scroll)



This is fine and how I want it to look. However, there is 6 other stats which I need to show. I wish to be able to scroll to the right and three new text views to appear (and back to the left when I get to the last three stats). This horizontal scroll view is the parent of a LinearLayout which has 9 child TextViews. I tried putting every three TextViews in there own linear layouts but was prevented because the Horizontal Scroll View can only have one LinearLayout child.



I currently have the other 6 stats visibility to gone because they are currently added below the top 3 stats in a vertical order like this image shows:



enter image description here



My plan was originally to pro-grammatically display the next three stats and hide the original when scrolled but before I programmed this I tested to see if the first three were scroll-able but they don't react when I try to scroll.



How do I got about this?



Here is my current xml:



 <HorizontalScrollView
android:id="@+id/sv_horizontalP1Stats"
android:layout_width="0dp"
android:layout_height="97dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
app:layout_constraintBottom_toBottomOf="@+id/sv_horizontalP2Stats"
app:layout_constraintEnd_toStartOf="@+id/sv_player1PastScores"
app:layout_constraintHorizontal_bias="0.596"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/iv_navArrowP1">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">

<TextView
android:id="@+id/tv_legAvg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="@string/tv_LegAVG"
android:textSize="13sp" />

<TextView
android:id="@+id/tv_matchAVG"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="@string/tv_MatchAVG"
android:textSize="13sp" />

<TextView
android:id="@+id/tv_first6Avg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="@string/tv_first6AVG"
android:textSize="13sp" />

<TextView
android:id="@+id/tv_100plus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/tv_100plus"
android:visibility="gone" />

<TextView
android:id="@+id/tv_140Plus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/tv_140plus"
android:visibility="gone" />

<TextView
android:id="@+id/tv_180s"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/tv_180"
android:visibility="gone" />

<TextView
android:id="@+id/tv_bestFinish"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/tv_bestFinish"
android:visibility="gone" />

<TextView
android:id="@+id/tv_bestLeg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/tv_BestLeg"
android:visibility="gone" />

<TextView
android:id="@+id/tv_doublesPercentage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/tv_doubles"
android:visibility="gone" />


</LinearLayout>

</HorizontalScrollView>









share|improve this question





























    0















    I am showing the user some stats. There is a lot of information on the screen so space is cramped. I decided to use a horizontal scroll view which contains 9 TextViews in total. However, I only want to display three of these text views at a time.



    Like so:



    scroll



    (The arrow is a just separate image view that just show's the user they can scroll)



    This is fine and how I want it to look. However, there is 6 other stats which I need to show. I wish to be able to scroll to the right and three new text views to appear (and back to the left when I get to the last three stats). This horizontal scroll view is the parent of a LinearLayout which has 9 child TextViews. I tried putting every three TextViews in there own linear layouts but was prevented because the Horizontal Scroll View can only have one LinearLayout child.



    I currently have the other 6 stats visibility to gone because they are currently added below the top 3 stats in a vertical order like this image shows:



    enter image description here



    My plan was originally to pro-grammatically display the next three stats and hide the original when scrolled but before I programmed this I tested to see if the first three were scroll-able but they don't react when I try to scroll.



    How do I got about this?



    Here is my current xml:



     <HorizontalScrollView
    android:id="@+id/sv_horizontalP1Stats"
    android:layout_width="0dp"
    android:layout_height="97dp"
    android:layout_marginStart="8dp"
    android:layout_marginLeft="8dp"
    app:layout_constraintBottom_toBottomOf="@+id/sv_horizontalP2Stats"
    app:layout_constraintEnd_toStartOf="@+id/sv_player1PastScores"
    app:layout_constraintHorizontal_bias="0.596"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/iv_navArrowP1">

    <LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <TextView
    android:id="@+id/tv_legAvg"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:gravity="center_vertical"
    android:text="@string/tv_LegAVG"
    android:textSize="13sp" />

    <TextView
    android:id="@+id/tv_matchAVG"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:gravity="center_vertical"
    android:text="@string/tv_MatchAVG"
    android:textSize="13sp" />

    <TextView
    android:id="@+id/tv_first6Avg"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:gravity="center_vertical"
    android:text="@string/tv_first6AVG"
    android:textSize="13sp" />

    <TextView
    android:id="@+id/tv_100plus"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:text="@string/tv_100plus"
    android:visibility="gone" />

    <TextView
    android:id="@+id/tv_140Plus"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:text="@string/tv_140plus"
    android:visibility="gone" />

    <TextView
    android:id="@+id/tv_180s"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:text="@string/tv_180"
    android:visibility="gone" />

    <TextView
    android:id="@+id/tv_bestFinish"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:text="@string/tv_bestFinish"
    android:visibility="gone" />

    <TextView
    android:id="@+id/tv_bestLeg"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:text="@string/tv_BestLeg"
    android:visibility="gone" />

    <TextView
    android:id="@+id/tv_doublesPercentage"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:text="@string/tv_doubles"
    android:visibility="gone" />


    </LinearLayout>

    </HorizontalScrollView>









    share|improve this question

























      0












      0








      0








      I am showing the user some stats. There is a lot of information on the screen so space is cramped. I decided to use a horizontal scroll view which contains 9 TextViews in total. However, I only want to display three of these text views at a time.



      Like so:



      scroll



      (The arrow is a just separate image view that just show's the user they can scroll)



      This is fine and how I want it to look. However, there is 6 other stats which I need to show. I wish to be able to scroll to the right and three new text views to appear (and back to the left when I get to the last three stats). This horizontal scroll view is the parent of a LinearLayout which has 9 child TextViews. I tried putting every three TextViews in there own linear layouts but was prevented because the Horizontal Scroll View can only have one LinearLayout child.



      I currently have the other 6 stats visibility to gone because they are currently added below the top 3 stats in a vertical order like this image shows:



      enter image description here



      My plan was originally to pro-grammatically display the next three stats and hide the original when scrolled but before I programmed this I tested to see if the first three were scroll-able but they don't react when I try to scroll.



      How do I got about this?



      Here is my current xml:



       <HorizontalScrollView
      android:id="@+id/sv_horizontalP1Stats"
      android:layout_width="0dp"
      android:layout_height="97dp"
      android:layout_marginStart="8dp"
      android:layout_marginLeft="8dp"
      app:layout_constraintBottom_toBottomOf="@+id/sv_horizontalP2Stats"
      app:layout_constraintEnd_toStartOf="@+id/sv_player1PastScores"
      app:layout_constraintHorizontal_bias="0.596"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toBottomOf="@+id/iv_navArrowP1">

      <LinearLayout
      android:layout_width="wrap_content"
      android:layout_height="match_parent"
      android:orientation="vertical">

      <TextView
      android:id="@+id/tv_legAvg"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:gravity="center_vertical"
      android:text="@string/tv_LegAVG"
      android:textSize="13sp" />

      <TextView
      android:id="@+id/tv_matchAVG"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:gravity="center_vertical"
      android:text="@string/tv_MatchAVG"
      android:textSize="13sp" />

      <TextView
      android:id="@+id/tv_first6Avg"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:gravity="center_vertical"
      android:text="@string/tv_first6AVG"
      android:textSize="13sp" />

      <TextView
      android:id="@+id/tv_100plus"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:text="@string/tv_100plus"
      android:visibility="gone" />

      <TextView
      android:id="@+id/tv_140Plus"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:text="@string/tv_140plus"
      android:visibility="gone" />

      <TextView
      android:id="@+id/tv_180s"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:text="@string/tv_180"
      android:visibility="gone" />

      <TextView
      android:id="@+id/tv_bestFinish"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:text="@string/tv_bestFinish"
      android:visibility="gone" />

      <TextView
      android:id="@+id/tv_bestLeg"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:text="@string/tv_BestLeg"
      android:visibility="gone" />

      <TextView
      android:id="@+id/tv_doublesPercentage"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:text="@string/tv_doubles"
      android:visibility="gone" />


      </LinearLayout>

      </HorizontalScrollView>









      share|improve this question














      I am showing the user some stats. There is a lot of information on the screen so space is cramped. I decided to use a horizontal scroll view which contains 9 TextViews in total. However, I only want to display three of these text views at a time.



      Like so:



      scroll



      (The arrow is a just separate image view that just show's the user they can scroll)



      This is fine and how I want it to look. However, there is 6 other stats which I need to show. I wish to be able to scroll to the right and three new text views to appear (and back to the left when I get to the last three stats). This horizontal scroll view is the parent of a LinearLayout which has 9 child TextViews. I tried putting every three TextViews in there own linear layouts but was prevented because the Horizontal Scroll View can only have one LinearLayout child.



      I currently have the other 6 stats visibility to gone because they are currently added below the top 3 stats in a vertical order like this image shows:



      enter image description here



      My plan was originally to pro-grammatically display the next three stats and hide the original when scrolled but before I programmed this I tested to see if the first three were scroll-able but they don't react when I try to scroll.



      How do I got about this?



      Here is my current xml:



       <HorizontalScrollView
      android:id="@+id/sv_horizontalP1Stats"
      android:layout_width="0dp"
      android:layout_height="97dp"
      android:layout_marginStart="8dp"
      android:layout_marginLeft="8dp"
      app:layout_constraintBottom_toBottomOf="@+id/sv_horizontalP2Stats"
      app:layout_constraintEnd_toStartOf="@+id/sv_player1PastScores"
      app:layout_constraintHorizontal_bias="0.596"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toBottomOf="@+id/iv_navArrowP1">

      <LinearLayout
      android:layout_width="wrap_content"
      android:layout_height="match_parent"
      android:orientation="vertical">

      <TextView
      android:id="@+id/tv_legAvg"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:gravity="center_vertical"
      android:text="@string/tv_LegAVG"
      android:textSize="13sp" />

      <TextView
      android:id="@+id/tv_matchAVG"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:gravity="center_vertical"
      android:text="@string/tv_MatchAVG"
      android:textSize="13sp" />

      <TextView
      android:id="@+id/tv_first6Avg"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:gravity="center_vertical"
      android:text="@string/tv_first6AVG"
      android:textSize="13sp" />

      <TextView
      android:id="@+id/tv_100plus"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:text="@string/tv_100plus"
      android:visibility="gone" />

      <TextView
      android:id="@+id/tv_140Plus"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:text="@string/tv_140plus"
      android:visibility="gone" />

      <TextView
      android:id="@+id/tv_180s"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:text="@string/tv_180"
      android:visibility="gone" />

      <TextView
      android:id="@+id/tv_bestFinish"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:text="@string/tv_bestFinish"
      android:visibility="gone" />

      <TextView
      android:id="@+id/tv_bestLeg"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:text="@string/tv_BestLeg"
      android:visibility="gone" />

      <TextView
      android:id="@+id/tv_doublesPercentage"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:text="@string/tv_doubles"
      android:visibility="gone" />


      </LinearLayout>

      </HorizontalScrollView>






      android xml






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 3 at 8:35









      COYGCOYG

      3811420




      3811420
























          1 Answer
          1






          active

          oldest

          votes


















          1














          All you need to do is create multiple linear layouts inside your main linear layout. Each containing 3 textviews and change the orientation of main linear layout to horizontal and you're good to go.



          e.g :



          <HorizontalScrollView
          android:id="@+id/sv_horizontalP1Stats"
          android:layout_width="0dp"
          android:layout_height="97dp"
          android:layout_marginStart="8dp"
          android:layout_marginLeft="8dp"
          app:layout_constraintBottom_toBottomOf="@+id/sv_horizontalP2Stats"
          app:layout_constraintEnd_toStartOf="@+id/sv_player1PastScores"
          app:layout_constraintHorizontal_bias="0.596"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toBottomOf="@+id/iv_navArrowP1">

          <LinearLayout
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:orientation="horizontal"> <!-- Changing orientation to horizontal -->

          <LinearLayout
          android:layout_width="0dp"
          android:layout_height="match_parent"
          android:layout_weight="1"
          android:orientation="vertical"> <!-- Group 1 of TV -->

          <TextView
          android:id="@+id/tv_legAvg"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:gravity="center_vertical"
          android:text="@string/tv_LegAVG"
          android:textSize="13sp" />

          <TextView
          android:id="@+id/tv_matchAVG"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:gravity="center_vertical"
          android:text="@string/tv_MatchAVG"
          android:textSize="13sp" />

          <TextView
          android:id="@+id/tv_first6Avg"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:gravity="center_vertical"
          android:text="@string/tv_first6AVG"
          android:textSize="13sp" />
          </LinearLayout>

          <LinearLayout
          android:layout_width="0dp"
          android:layout_height="match_parent"
          android:layout_weight="1"
          android:orientation="vertical"> <!-- Group 2 -->

          // .. Next three
          </LinearLayout>

          // .. And soo on

          </LinearLayout>

          </HorizontalScrollView>`





          share|improve this answer
























          • I think you need to apply constraints for each inner linear layout otherwise this will result into zero width layout.

            – nikhil bansal
            Jan 3 at 9:12











          • This is what I was looking for. I attempted something like this before only I was missing the one of the top nested LinearLayout.and was getting the HorizontalScrollView can only have one child error. Thanks!

            – COYG
            Jan 3 at 9:28












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54018784%2fhorizontal-scroll-view-with-child-textviews-not-scrolling%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          All you need to do is create multiple linear layouts inside your main linear layout. Each containing 3 textviews and change the orientation of main linear layout to horizontal and you're good to go.



          e.g :



          <HorizontalScrollView
          android:id="@+id/sv_horizontalP1Stats"
          android:layout_width="0dp"
          android:layout_height="97dp"
          android:layout_marginStart="8dp"
          android:layout_marginLeft="8dp"
          app:layout_constraintBottom_toBottomOf="@+id/sv_horizontalP2Stats"
          app:layout_constraintEnd_toStartOf="@+id/sv_player1PastScores"
          app:layout_constraintHorizontal_bias="0.596"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toBottomOf="@+id/iv_navArrowP1">

          <LinearLayout
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:orientation="horizontal"> <!-- Changing orientation to horizontal -->

          <LinearLayout
          android:layout_width="0dp"
          android:layout_height="match_parent"
          android:layout_weight="1"
          android:orientation="vertical"> <!-- Group 1 of TV -->

          <TextView
          android:id="@+id/tv_legAvg"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:gravity="center_vertical"
          android:text="@string/tv_LegAVG"
          android:textSize="13sp" />

          <TextView
          android:id="@+id/tv_matchAVG"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:gravity="center_vertical"
          android:text="@string/tv_MatchAVG"
          android:textSize="13sp" />

          <TextView
          android:id="@+id/tv_first6Avg"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:gravity="center_vertical"
          android:text="@string/tv_first6AVG"
          android:textSize="13sp" />
          </LinearLayout>

          <LinearLayout
          android:layout_width="0dp"
          android:layout_height="match_parent"
          android:layout_weight="1"
          android:orientation="vertical"> <!-- Group 2 -->

          // .. Next three
          </LinearLayout>

          // .. And soo on

          </LinearLayout>

          </HorizontalScrollView>`





          share|improve this answer
























          • I think you need to apply constraints for each inner linear layout otherwise this will result into zero width layout.

            – nikhil bansal
            Jan 3 at 9:12











          • This is what I was looking for. I attempted something like this before only I was missing the one of the top nested LinearLayout.and was getting the HorizontalScrollView can only have one child error. Thanks!

            – COYG
            Jan 3 at 9:28
















          1














          All you need to do is create multiple linear layouts inside your main linear layout. Each containing 3 textviews and change the orientation of main linear layout to horizontal and you're good to go.



          e.g :



          <HorizontalScrollView
          android:id="@+id/sv_horizontalP1Stats"
          android:layout_width="0dp"
          android:layout_height="97dp"
          android:layout_marginStart="8dp"
          android:layout_marginLeft="8dp"
          app:layout_constraintBottom_toBottomOf="@+id/sv_horizontalP2Stats"
          app:layout_constraintEnd_toStartOf="@+id/sv_player1PastScores"
          app:layout_constraintHorizontal_bias="0.596"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toBottomOf="@+id/iv_navArrowP1">

          <LinearLayout
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:orientation="horizontal"> <!-- Changing orientation to horizontal -->

          <LinearLayout
          android:layout_width="0dp"
          android:layout_height="match_parent"
          android:layout_weight="1"
          android:orientation="vertical"> <!-- Group 1 of TV -->

          <TextView
          android:id="@+id/tv_legAvg"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:gravity="center_vertical"
          android:text="@string/tv_LegAVG"
          android:textSize="13sp" />

          <TextView
          android:id="@+id/tv_matchAVG"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:gravity="center_vertical"
          android:text="@string/tv_MatchAVG"
          android:textSize="13sp" />

          <TextView
          android:id="@+id/tv_first6Avg"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:gravity="center_vertical"
          android:text="@string/tv_first6AVG"
          android:textSize="13sp" />
          </LinearLayout>

          <LinearLayout
          android:layout_width="0dp"
          android:layout_height="match_parent"
          android:layout_weight="1"
          android:orientation="vertical"> <!-- Group 2 -->

          // .. Next three
          </LinearLayout>

          // .. And soo on

          </LinearLayout>

          </HorizontalScrollView>`





          share|improve this answer
























          • I think you need to apply constraints for each inner linear layout otherwise this will result into zero width layout.

            – nikhil bansal
            Jan 3 at 9:12











          • This is what I was looking for. I attempted something like this before only I was missing the one of the top nested LinearLayout.and was getting the HorizontalScrollView can only have one child error. Thanks!

            – COYG
            Jan 3 at 9:28














          1












          1








          1







          All you need to do is create multiple linear layouts inside your main linear layout. Each containing 3 textviews and change the orientation of main linear layout to horizontal and you're good to go.



          e.g :



          <HorizontalScrollView
          android:id="@+id/sv_horizontalP1Stats"
          android:layout_width="0dp"
          android:layout_height="97dp"
          android:layout_marginStart="8dp"
          android:layout_marginLeft="8dp"
          app:layout_constraintBottom_toBottomOf="@+id/sv_horizontalP2Stats"
          app:layout_constraintEnd_toStartOf="@+id/sv_player1PastScores"
          app:layout_constraintHorizontal_bias="0.596"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toBottomOf="@+id/iv_navArrowP1">

          <LinearLayout
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:orientation="horizontal"> <!-- Changing orientation to horizontal -->

          <LinearLayout
          android:layout_width="0dp"
          android:layout_height="match_parent"
          android:layout_weight="1"
          android:orientation="vertical"> <!-- Group 1 of TV -->

          <TextView
          android:id="@+id/tv_legAvg"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:gravity="center_vertical"
          android:text="@string/tv_LegAVG"
          android:textSize="13sp" />

          <TextView
          android:id="@+id/tv_matchAVG"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:gravity="center_vertical"
          android:text="@string/tv_MatchAVG"
          android:textSize="13sp" />

          <TextView
          android:id="@+id/tv_first6Avg"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:gravity="center_vertical"
          android:text="@string/tv_first6AVG"
          android:textSize="13sp" />
          </LinearLayout>

          <LinearLayout
          android:layout_width="0dp"
          android:layout_height="match_parent"
          android:layout_weight="1"
          android:orientation="vertical"> <!-- Group 2 -->

          // .. Next three
          </LinearLayout>

          // .. And soo on

          </LinearLayout>

          </HorizontalScrollView>`





          share|improve this answer













          All you need to do is create multiple linear layouts inside your main linear layout. Each containing 3 textviews and change the orientation of main linear layout to horizontal and you're good to go.



          e.g :



          <HorizontalScrollView
          android:id="@+id/sv_horizontalP1Stats"
          android:layout_width="0dp"
          android:layout_height="97dp"
          android:layout_marginStart="8dp"
          android:layout_marginLeft="8dp"
          app:layout_constraintBottom_toBottomOf="@+id/sv_horizontalP2Stats"
          app:layout_constraintEnd_toStartOf="@+id/sv_player1PastScores"
          app:layout_constraintHorizontal_bias="0.596"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toBottomOf="@+id/iv_navArrowP1">

          <LinearLayout
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:orientation="horizontal"> <!-- Changing orientation to horizontal -->

          <LinearLayout
          android:layout_width="0dp"
          android:layout_height="match_parent"
          android:layout_weight="1"
          android:orientation="vertical"> <!-- Group 1 of TV -->

          <TextView
          android:id="@+id/tv_legAvg"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:gravity="center_vertical"
          android:text="@string/tv_LegAVG"
          android:textSize="13sp" />

          <TextView
          android:id="@+id/tv_matchAVG"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:gravity="center_vertical"
          android:text="@string/tv_MatchAVG"
          android:textSize="13sp" />

          <TextView
          android:id="@+id/tv_first6Avg"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:gravity="center_vertical"
          android:text="@string/tv_first6AVG"
          android:textSize="13sp" />
          </LinearLayout>

          <LinearLayout
          android:layout_width="0dp"
          android:layout_height="match_parent"
          android:layout_weight="1"
          android:orientation="vertical"> <!-- Group 2 -->

          // .. Next three
          </LinearLayout>

          // .. And soo on

          </LinearLayout>

          </HorizontalScrollView>`






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 3 at 9:04









          Mohammed JunaidMohammed Junaid

          790815




          790815













          • I think you need to apply constraints for each inner linear layout otherwise this will result into zero width layout.

            – nikhil bansal
            Jan 3 at 9:12











          • This is what I was looking for. I attempted something like this before only I was missing the one of the top nested LinearLayout.and was getting the HorizontalScrollView can only have one child error. Thanks!

            – COYG
            Jan 3 at 9:28



















          • I think you need to apply constraints for each inner linear layout otherwise this will result into zero width layout.

            – nikhil bansal
            Jan 3 at 9:12











          • This is what I was looking for. I attempted something like this before only I was missing the one of the top nested LinearLayout.and was getting the HorizontalScrollView can only have one child error. Thanks!

            – COYG
            Jan 3 at 9:28

















          I think you need to apply constraints for each inner linear layout otherwise this will result into zero width layout.

          – nikhil bansal
          Jan 3 at 9:12





          I think you need to apply constraints for each inner linear layout otherwise this will result into zero width layout.

          – nikhil bansal
          Jan 3 at 9:12













          This is what I was looking for. I attempted something like this before only I was missing the one of the top nested LinearLayout.and was getting the HorizontalScrollView can only have one child error. Thanks!

          – COYG
          Jan 3 at 9:28





          This is what I was looking for. I attempted something like this before only I was missing the one of the top nested LinearLayout.and was getting the HorizontalScrollView can only have one child error. Thanks!

          – COYG
          Jan 3 at 9:28




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54018784%2fhorizontal-scroll-view-with-child-textviews-not-scrolling%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          MongoDB - Not Authorized To Execute Command

          How to fix TextFormField cause rebuild widget in Flutter

          Npm cannot find a required file even through it is in the searched directory