Remove Left margin from TabLayout
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>
android tabs android-toolbar android-tablayout
|
show 1 more comment
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>
android tabs android-toolbar android-tablayout
Test case useapp: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 changeapp:tabMode
– Nilesh Rathod
Nov 16 '18 at 6:19
So what iscustom_toolbar
? You are already using anotherToolbar
?
– Cagri Yalcin
Nov 16 '18 at 6:19
this answer may help you.
– Cagri Yalcin
Nov 16 '18 at 6:22
|
show 1 more comment
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>
android tabs android-toolbar android-tablayout
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>
android tabs android-toolbar android-tablayout
android tabs android-toolbar android-tablayout
edited Nov 16 '18 at 6:09
Dev Sharma
asked Nov 16 '18 at 6:07
Dev SharmaDev Sharma
5610
5610
Test case useapp: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 changeapp:tabMode
– Nilesh Rathod
Nov 16 '18 at 6:19
So what iscustom_toolbar
? You are already using anotherToolbar
?
– Cagri Yalcin
Nov 16 '18 at 6:19
this answer may help you.
– Cagri Yalcin
Nov 16 '18 at 6:22
|
show 1 more comment
Test case useapp: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 changeapp:tabMode
– Nilesh Rathod
Nov 16 '18 at 6:19
So what iscustom_toolbar
? You are already using anotherToolbar
?
– 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
|
show 1 more comment
2 Answers
2
active
oldest
votes
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>
add a comment |
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">
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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>
add a comment |
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>
add a comment |
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>
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>
answered Nov 16 '18 at 6:30
Android TeamAndroid Team
8,01011437
8,01011437
add a comment |
add a comment |
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">
add a comment |
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">
add a comment |
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">
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">
answered Nov 16 '18 at 6:14
Harish JoseHarish Jose
14628
14628
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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 anotherToolbar
?– Cagri Yalcin
Nov 16 '18 at 6:19
this answer may help you.
– Cagri Yalcin
Nov 16 '18 at 6:22