The Tabs in TabLayout cover the Fragment











up vote
0
down vote

favorite












The Tabs cover the Fragment's top. I want the Fragment to reduce its height and go down a little to show the whole Fragment's layout.



This is how I make the Tabs:



<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabIconTintMode="src_over"
app:tabMode="fixed"

<android.support.design.widget.TabItem
android:id="@+id/tab1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

<android.support.design.widget.TabItem
android:id="@+id/tab2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

<android.support.design.widget.TabItem
android:id="@+id/tab3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</android.support.design.widget.TabLayout>


And here is the code:



    tabLayout = (TabLayout)findViewById(R.id.tabLayout);
fragments = getFragments();//To get all the fragments under ViewPager
pagerAdapter = new MyPagerAdapter(getSupportFragmentManager());
viewPager = (ViewPager)findViewById(R.id.mainViewPager);
viewPager.setAdapter(pagerAdapter);
tabLayout.setupWithViewPager(viewPager);









share|improve this question


























    up vote
    0
    down vote

    favorite












    The Tabs cover the Fragment's top. I want the Fragment to reduce its height and go down a little to show the whole Fragment's layout.



    This is how I make the Tabs:



    <android.support.design.widget.TabLayout
    android:id="@+id/tabLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:tabIconTintMode="src_over"
    app:tabMode="fixed"

    <android.support.design.widget.TabItem
    android:id="@+id/tab1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

    <android.support.design.widget.TabItem
    android:id="@+id/tab2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

    <android.support.design.widget.TabItem
    android:id="@+id/tab3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />
    </android.support.design.widget.TabLayout>


    And here is the code:



        tabLayout = (TabLayout)findViewById(R.id.tabLayout);
    fragments = getFragments();//To get all the fragments under ViewPager
    pagerAdapter = new MyPagerAdapter(getSupportFragmentManager());
    viewPager = (ViewPager)findViewById(R.id.mainViewPager);
    viewPager.setAdapter(pagerAdapter);
    tabLayout.setupWithViewPager(viewPager);









    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      The Tabs cover the Fragment's top. I want the Fragment to reduce its height and go down a little to show the whole Fragment's layout.



      This is how I make the Tabs:



      <android.support.design.widget.TabLayout
      android:id="@+id/tabLayout"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      app:tabIconTintMode="src_over"
      app:tabMode="fixed"

      <android.support.design.widget.TabItem
      android:id="@+id/tab1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" />

      <android.support.design.widget.TabItem
      android:id="@+id/tab2"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" />

      <android.support.design.widget.TabItem
      android:id="@+id/tab3"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" />
      </android.support.design.widget.TabLayout>


      And here is the code:



          tabLayout = (TabLayout)findViewById(R.id.tabLayout);
      fragments = getFragments();//To get all the fragments under ViewPager
      pagerAdapter = new MyPagerAdapter(getSupportFragmentManager());
      viewPager = (ViewPager)findViewById(R.id.mainViewPager);
      viewPager.setAdapter(pagerAdapter);
      tabLayout.setupWithViewPager(viewPager);









      share|improve this question













      The Tabs cover the Fragment's top. I want the Fragment to reduce its height and go down a little to show the whole Fragment's layout.



      This is how I make the Tabs:



      <android.support.design.widget.TabLayout
      android:id="@+id/tabLayout"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      app:tabIconTintMode="src_over"
      app:tabMode="fixed"

      <android.support.design.widget.TabItem
      android:id="@+id/tab1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" />

      <android.support.design.widget.TabItem
      android:id="@+id/tab2"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" />

      <android.support.design.widget.TabItem
      android:id="@+id/tab3"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" />
      </android.support.design.widget.TabLayout>


      And here is the code:



          tabLayout = (TabLayout)findViewById(R.id.tabLayout);
      fragments = getFragments();//To get all the fragments under ViewPager
      pagerAdapter = new MyPagerAdapter(getSupportFragmentManager());
      viewPager = (ViewPager)findViewById(R.id.mainViewPager);
      viewPager.setAdapter(pagerAdapter);
      tabLayout.setupWithViewPager(viewPager);






      android-tablayout






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 17 at 15:52









      Cuber

      11




      11
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          If you are using the TabLayout with ViewPager, try adding the attribute app:layout_behavior="android.support.design.widget.AppBarLayout$ScrollingViewBehavior"



          Or, add the attribute layout_below=YOUR_APP_BAR_ID to your TabsLayout






          share|improve this answer





















            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',
            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%2f51899025%2fthe-tabs-in-tablayout-cover-the-fragment%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








            up vote
            0
            down vote













            If you are using the TabLayout with ViewPager, try adding the attribute app:layout_behavior="android.support.design.widget.AppBarLayout$ScrollingViewBehavior"



            Or, add the attribute layout_below=YOUR_APP_BAR_ID to your TabsLayout






            share|improve this answer

























              up vote
              0
              down vote













              If you are using the TabLayout with ViewPager, try adding the attribute app:layout_behavior="android.support.design.widget.AppBarLayout$ScrollingViewBehavior"



              Or, add the attribute layout_below=YOUR_APP_BAR_ID to your TabsLayout






              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                If you are using the TabLayout with ViewPager, try adding the attribute app:layout_behavior="android.support.design.widget.AppBarLayout$ScrollingViewBehavior"



                Or, add the attribute layout_below=YOUR_APP_BAR_ID to your TabsLayout






                share|improve this answer












                If you are using the TabLayout with ViewPager, try adding the attribute app:layout_behavior="android.support.design.widget.AppBarLayout$ScrollingViewBehavior"



                Or, add the attribute layout_below=YOUR_APP_BAR_ID to your TabsLayout







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 21 at 9:32









                jackz314

                7113




                7113






























                    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.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • 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%2f51899025%2fthe-tabs-in-tablayout-cover-the-fragment%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

                    Sphinx de Gizeh

                    Dijon

                    Équipe cycliste