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);
android-tablayout
add a comment |
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);
android-tablayout
add a comment |
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);
android-tablayout
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
android-tablayout
asked Aug 17 at 15:52
Cuber
11
11
add a comment |
add a comment |
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
add a comment |
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
add a comment |
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
add a comment |
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
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
answered Nov 21 at 9:32
jackz314
7113
7113
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.
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.
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%2f51899025%2fthe-tabs-in-tablayout-cover-the-fragment%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