Remove Left margin from TabLayout












0















I am using TabLayout inside Toolbar with four tabs. I'm getting left margin for the TabLayout. How can I remove the margin so that the TabLayout fills the Toolbar?



<android.support.v7.widget.Toolbar
android:id="@+id/tabsToolbar"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_below="@id/custom_toolbar"
android:background="@color/white">

<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:tabBackground="@drawable/tab_color_selector"
app:tabGravity="fill"
app:tabMode="fixed">

<android.support.design.widget.TabItem
android:id="@+id/ti1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tata CLIQ" />

<android.support.design.widget.TabItem
android:id="@+id/ti4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Paytm Mall" />
</android.support.design.widget.TabLayout>
</android.support.v7.widget.Toolbar>


enter image description here










share|improve this question

























  • Test case use app:tabMode="scrollable"

    – Nilesh Rathod
    Nov 16 '18 at 6:08













  • It didn't work.

    – Dev Sharma
    Nov 16 '18 at 6:18











  • Than try to change app:tabMode

    – Nilesh Rathod
    Nov 16 '18 at 6:19











  • So what is custom_toolbar ? You are already using another Toolbar ?

    – Cagri Yalcin
    Nov 16 '18 at 6:19











  • this answer may help you.

    – Cagri Yalcin
    Nov 16 '18 at 6:22
















0















I am using TabLayout inside Toolbar with four tabs. I'm getting left margin for the TabLayout. How can I remove the margin so that the TabLayout fills the Toolbar?



<android.support.v7.widget.Toolbar
android:id="@+id/tabsToolbar"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_below="@id/custom_toolbar"
android:background="@color/white">

<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:tabBackground="@drawable/tab_color_selector"
app:tabGravity="fill"
app:tabMode="fixed">

<android.support.design.widget.TabItem
android:id="@+id/ti1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tata CLIQ" />

<android.support.design.widget.TabItem
android:id="@+id/ti4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Paytm Mall" />
</android.support.design.widget.TabLayout>
</android.support.v7.widget.Toolbar>


enter image description here










share|improve this question

























  • Test case use app:tabMode="scrollable"

    – Nilesh Rathod
    Nov 16 '18 at 6:08













  • It didn't work.

    – Dev Sharma
    Nov 16 '18 at 6:18











  • Than try to change app:tabMode

    – Nilesh Rathod
    Nov 16 '18 at 6:19











  • So what is custom_toolbar ? You are already using another Toolbar ?

    – Cagri Yalcin
    Nov 16 '18 at 6:19











  • this answer may help you.

    – Cagri Yalcin
    Nov 16 '18 at 6:22














0












0








0








I am using TabLayout inside Toolbar with four tabs. I'm getting left margin for the TabLayout. How can I remove the margin so that the TabLayout fills the Toolbar?



<android.support.v7.widget.Toolbar
android:id="@+id/tabsToolbar"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_below="@id/custom_toolbar"
android:background="@color/white">

<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:tabBackground="@drawable/tab_color_selector"
app:tabGravity="fill"
app:tabMode="fixed">

<android.support.design.widget.TabItem
android:id="@+id/ti1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tata CLIQ" />

<android.support.design.widget.TabItem
android:id="@+id/ti4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Paytm Mall" />
</android.support.design.widget.TabLayout>
</android.support.v7.widget.Toolbar>


enter image description here










share|improve this question
















I am using TabLayout inside Toolbar with four tabs. I'm getting left margin for the TabLayout. How can I remove the margin so that the TabLayout fills the Toolbar?



<android.support.v7.widget.Toolbar
android:id="@+id/tabsToolbar"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_below="@id/custom_toolbar"
android:background="@color/white">

<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:tabBackground="@drawable/tab_color_selector"
app:tabGravity="fill"
app:tabMode="fixed">

<android.support.design.widget.TabItem
android:id="@+id/ti1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tata CLIQ" />

<android.support.design.widget.TabItem
android:id="@+id/ti4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Paytm Mall" />
</android.support.design.widget.TabLayout>
</android.support.v7.widget.Toolbar>


enter image description here







android tabs android-toolbar android-tablayout






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 6:09







Dev Sharma

















asked Nov 16 '18 at 6:07









Dev SharmaDev Sharma

5610




5610













  • Test case use app:tabMode="scrollable"

    – Nilesh Rathod
    Nov 16 '18 at 6:08













  • It didn't work.

    – Dev Sharma
    Nov 16 '18 at 6:18











  • Than try to change app:tabMode

    – Nilesh Rathod
    Nov 16 '18 at 6:19











  • So what is custom_toolbar ? You are already using another Toolbar ?

    – Cagri Yalcin
    Nov 16 '18 at 6:19











  • this answer may help you.

    – Cagri Yalcin
    Nov 16 '18 at 6:22



















  • Test case use app:tabMode="scrollable"

    – Nilesh Rathod
    Nov 16 '18 at 6:08













  • It didn't work.

    – Dev Sharma
    Nov 16 '18 at 6:18











  • Than try to change app:tabMode

    – Nilesh Rathod
    Nov 16 '18 at 6:19











  • So what is custom_toolbar ? You are already using another Toolbar ?

    – Cagri Yalcin
    Nov 16 '18 at 6:19











  • this answer may help you.

    – Cagri Yalcin
    Nov 16 '18 at 6:22

















Test case use app:tabMode="scrollable"

– Nilesh Rathod
Nov 16 '18 at 6:08







Test case use app:tabMode="scrollable"

– Nilesh Rathod
Nov 16 '18 at 6:08















It didn't work.

– Dev Sharma
Nov 16 '18 at 6:18





It didn't work.

– Dev Sharma
Nov 16 '18 at 6:18













Than try to change app:tabMode

– Nilesh Rathod
Nov 16 '18 at 6:19





Than try to change app:tabMode

– Nilesh Rathod
Nov 16 '18 at 6:19













So what is custom_toolbar ? You are already using another Toolbar ?

– Cagri Yalcin
Nov 16 '18 at 6:19





So what is custom_toolbar ? You are already using another Toolbar ?

– Cagri Yalcin
Nov 16 '18 at 6:19













this answer may help you.

– Cagri Yalcin
Nov 16 '18 at 6:22





this answer may help you.

– Cagri Yalcin
Nov 16 '18 at 6:22












2 Answers
2






active

oldest

votes


















1














Try this code..
only add this below things into toolbar..



  android:contentInsetStart="0dp"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
android:contentInsetRight="0dp"
android:contentInsetEnd="0dp"
app:contentInsetRight="0dp"
app:contentInsetEnd="0dp"





<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.v7.widget.Toolbar
android:id="@+id/tabsToolbar"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="#fff"
android:contentInsetStart="0dp"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
android:contentInsetRight="0dp"
android:contentInsetEnd="0dp"
app:contentInsetRight="0dp"
app:contentInsetEnd="0dp"
>

<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:tabGravity="fill">

<android.support.design.widget.TabItem
android:id="@+id/ti1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tata CLIQ" />

<android.support.design.widget.TabItem
android:id="@+id/ti4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Paytm Mall" />
</android.support.design.widget.TabLayout>
</android.support.v7.widget.Toolbar>







share|improve this answer































    1














    Add




    app:contentInsetStartWithNavigation="0dp"




    in the toolbar tag.



    <android.support.v7.widget.Toolbar
    android:id="@+id/tabsToolbar"
    android:layout_width="match_parent"
    android:layout_height="60dp"
    android:layout_below="@id/custom_toolbar"
    android:background="@color/white"
    app:contentInsetStartWithNavigation="0dp">





    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',
      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%2f53332320%2fremove-left-margin-from-tablayout%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      Try this code..
      only add this below things into toolbar..



        android:contentInsetStart="0dp"
      app:contentInsetLeft="0dp"
      app:contentInsetStart="0dp"
      android:contentInsetRight="0dp"
      android:contentInsetEnd="0dp"
      app:contentInsetRight="0dp"
      app:contentInsetEnd="0dp"





      <?xml version="1.0" encoding="utf-8"?>
      <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      xmlns:app="http://schemas.android.com/apk/res-auto">
      <android.support.v7.widget.Toolbar
      android:id="@+id/tabsToolbar"
      android:layout_width="match_parent"
      android:layout_height="60dp"
      android:background="#fff"
      android:contentInsetStart="0dp"
      app:contentInsetLeft="0dp"
      app:contentInsetStart="0dp"
      android:contentInsetRight="0dp"
      android:contentInsetEnd="0dp"
      app:contentInsetRight="0dp"
      app:contentInsetEnd="0dp"
      >

      <android.support.design.widget.TabLayout
      android:id="@+id/tabLayout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      app:tabGravity="fill">

      <android.support.design.widget.TabItem
      android:id="@+id/ti1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="Tata CLIQ" />

      <android.support.design.widget.TabItem
      android:id="@+id/ti4"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="Paytm Mall" />
      </android.support.design.widget.TabLayout>
      </android.support.v7.widget.Toolbar>







      share|improve this answer




























        1














        Try this code..
        only add this below things into toolbar..



          android:contentInsetStart="0dp"
        app:contentInsetLeft="0dp"
        app:contentInsetStart="0dp"
        android:contentInsetRight="0dp"
        android:contentInsetEnd="0dp"
        app:contentInsetRight="0dp"
        app:contentInsetEnd="0dp"





        <?xml version="1.0" encoding="utf-8"?>
        <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        xmlns:app="http://schemas.android.com/apk/res-auto">
        <android.support.v7.widget.Toolbar
        android:id="@+id/tabsToolbar"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:background="#fff"
        android:contentInsetStart="0dp"
        app:contentInsetLeft="0dp"
        app:contentInsetStart="0dp"
        android:contentInsetRight="0dp"
        android:contentInsetEnd="0dp"
        app:contentInsetRight="0dp"
        app:contentInsetEnd="0dp"
        >

        <android.support.design.widget.TabLayout
        android:id="@+id/tabLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:tabGravity="fill">

        <android.support.design.widget.TabItem
        android:id="@+id/ti1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Tata CLIQ" />

        <android.support.design.widget.TabItem
        android:id="@+id/ti4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Paytm Mall" />
        </android.support.design.widget.TabLayout>
        </android.support.v7.widget.Toolbar>







        share|improve this answer


























          1












          1








          1







          Try this code..
          only add this below things into toolbar..



            android:contentInsetStart="0dp"
          app:contentInsetLeft="0dp"
          app:contentInsetStart="0dp"
          android:contentInsetRight="0dp"
          android:contentInsetEnd="0dp"
          app:contentInsetRight="0dp"
          app:contentInsetEnd="0dp"





          <?xml version="1.0" encoding="utf-8"?>
          <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          xmlns:app="http://schemas.android.com/apk/res-auto">
          <android.support.v7.widget.Toolbar
          android:id="@+id/tabsToolbar"
          android:layout_width="match_parent"
          android:layout_height="60dp"
          android:background="#fff"
          android:contentInsetStart="0dp"
          app:contentInsetLeft="0dp"
          app:contentInsetStart="0dp"
          android:contentInsetRight="0dp"
          android:contentInsetEnd="0dp"
          app:contentInsetRight="0dp"
          app:contentInsetEnd="0dp"
          >

          <android.support.design.widget.TabLayout
          android:id="@+id/tabLayout"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          app:tabGravity="fill">

          <android.support.design.widget.TabItem
          android:id="@+id/ti1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Tata CLIQ" />

          <android.support.design.widget.TabItem
          android:id="@+id/ti4"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Paytm Mall" />
          </android.support.design.widget.TabLayout>
          </android.support.v7.widget.Toolbar>







          share|improve this answer













          Try this code..
          only add this below things into toolbar..



            android:contentInsetStart="0dp"
          app:contentInsetLeft="0dp"
          app:contentInsetStart="0dp"
          android:contentInsetRight="0dp"
          android:contentInsetEnd="0dp"
          app:contentInsetRight="0dp"
          app:contentInsetEnd="0dp"





          <?xml version="1.0" encoding="utf-8"?>
          <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          xmlns:app="http://schemas.android.com/apk/res-auto">
          <android.support.v7.widget.Toolbar
          android:id="@+id/tabsToolbar"
          android:layout_width="match_parent"
          android:layout_height="60dp"
          android:background="#fff"
          android:contentInsetStart="0dp"
          app:contentInsetLeft="0dp"
          app:contentInsetStart="0dp"
          android:contentInsetRight="0dp"
          android:contentInsetEnd="0dp"
          app:contentInsetRight="0dp"
          app:contentInsetEnd="0dp"
          >

          <android.support.design.widget.TabLayout
          android:id="@+id/tabLayout"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          app:tabGravity="fill">

          <android.support.design.widget.TabItem
          android:id="@+id/ti1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Tata CLIQ" />

          <android.support.design.widget.TabItem
          android:id="@+id/ti4"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Paytm Mall" />
          </android.support.design.widget.TabLayout>
          </android.support.v7.widget.Toolbar>








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 16 '18 at 6:30









          Android TeamAndroid Team

          7,86011336




          7,86011336

























              1














              Add




              app:contentInsetStartWithNavigation="0dp"




              in the toolbar tag.



              <android.support.v7.widget.Toolbar
              android:id="@+id/tabsToolbar"
              android:layout_width="match_parent"
              android:layout_height="60dp"
              android:layout_below="@id/custom_toolbar"
              android:background="@color/white"
              app:contentInsetStartWithNavigation="0dp">





              share|improve this answer




























                1














                Add




                app:contentInsetStartWithNavigation="0dp"




                in the toolbar tag.



                <android.support.v7.widget.Toolbar
                android:id="@+id/tabsToolbar"
                android:layout_width="match_parent"
                android:layout_height="60dp"
                android:layout_below="@id/custom_toolbar"
                android:background="@color/white"
                app:contentInsetStartWithNavigation="0dp">





                share|improve this answer


























                  1












                  1








                  1







                  Add




                  app:contentInsetStartWithNavigation="0dp"




                  in the toolbar tag.



                  <android.support.v7.widget.Toolbar
                  android:id="@+id/tabsToolbar"
                  android:layout_width="match_parent"
                  android:layout_height="60dp"
                  android:layout_below="@id/custom_toolbar"
                  android:background="@color/white"
                  app:contentInsetStartWithNavigation="0dp">





                  share|improve this answer













                  Add




                  app:contentInsetStartWithNavigation="0dp"




                  in the toolbar tag.



                  <android.support.v7.widget.Toolbar
                  android:id="@+id/tabsToolbar"
                  android:layout_width="match_parent"
                  android:layout_height="60dp"
                  android:layout_below="@id/custom_toolbar"
                  android:background="@color/white"
                  app:contentInsetStartWithNavigation="0dp">






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 16 '18 at 6:14









                  Harish JoseHarish Jose

                  14628




                  14628






























                      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%2f53332320%2fremove-left-margin-from-tablayout%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

                      Xamarin.iOS Cant Deploy on Iphone

                      Glorious Revolution

                      Dulmage-Mendelsohn matrix decomposition in Python