Fix bottom bar in CoordinatorLayout –

Development issue/problem:

I have a CoordinatorLayout that contains an AppBarLayout and a FrameLayout that contains clippings.

One of the fragments contains a TabLayout at the top, a list via RecyclerView and a self-made toolbar at the bottom.

AppBarLayout is configured with app:layout_scrollFlags=scroll|enterAlways.

My problem is that the two toolbars are hidden when scrolling, AppBarLayout and my Home toolbar at the bottom. That’s the current behavior

I would like to repair the bottom homemade toolbar so that it remains visible, but I can’t do that.

This is the XML format of the extract.

EDIT1 : These issues seem to be the same problem.

How can I solve this problem?

Solution 1:

Try this layout:

Solution 2:

For example, you can try adding the collapse mode to your toolbar.

Your apartment seems to be in good condition.

I suggest you consult this link:
https://github.com/codepath/android_guides/wiki/Handling-Scrolls-with-CoordinatorLayout
`.

Solution 3:

Try this

Result

Solution 4:

This behavior essentially removes the SCROLL flag from the AppBarLayout if the content to be scrolled in the dependent view (RecyclerView, NestedScrollView) is smaller than the height of the view, i.e. if scrolling is not required. It also makes it possible to bypass the display scrolling offset, which is normally done by AppBarLayout.ScrollingViewBehavior. Works well when adding, for example, a footer. For example a button, for the scroll view, or in the ViewPager, where the length of the content on each page may be different.

https://gist.github.com/MaciejKaras/02bff315f0 7d80467a470424f22c3

The answer can already be found on https://stackoverflow.com/a/37293634.

Solution No 5:

To fix the bottom panel, you must first use the activity in which the tabs are present. Different fragments are used in this activity. Add yourLayout tab to this Active_main_tab.xml file.

Active_main_table.xml

To see fragments

snippet_tab.xml

Use app:layout_scrollFlags=scroll|enterAlways on the toolbar here to scroll.

FragmentTabs.java

The FragmentTabs public class expands the BaseFragment{

private ViewPager rootView;
private ViewPager ViewPager;
private TabLayout tabLayout;
private toolbar;
private ViewPagerAdapter viewPagerAdapter ;

@View
public View onCreateView(LayoutInflater inflater, ViewGroup ViewGroupContainer, Bundle savedInstanceState) {
rootViewSearch = inflater.inflate(R.layout.fragment_tab, viewGroupContainer, false);
initializeLayout();
setUpActionBar();
setUpFragmentObjects() ;

back to rootView;
}

private void initializeLayout() {
toolbar = (toolbar) rootView.findViewById(R.id.toolbar);
viewPager = (ViewPager) rootView.findViewById(R.id.viewpager);
tabLayout = (TabLayout) rootView.findViewById(R.id.tablayout);
}

private void setUpActionBar() {
getApplicationContext().setSupportActionBar(toolbarSearch);
actionBar = getApplicationContext().getSupportActionBar();
if(actionBar != null){
actionBar.setTitle(Constants.BLANK);
}
}.

private void setUpFragmentObjects() {
viewPagerAdapter = new ViewPagerAdapter(getApplicationContext(), getChildFragmentManager());
viewPager.setAdapter(searchViewPagerAdapter);
tabLayout.setupMetViewPager(viewPager);
}
}

See the .java homepage adapter

The ViewPagerAdapter public class extends the FragmentPagerAdapter {

public ViewPagerAdapter(Activity, FragmentManager fragmentManager) {
super(fragmentManager);
}

@Public fragmentation check
item (int position) {
Bundle; switch (position)
{
case 0 : // For tablet 1
// Use of fragment for tablet 1
returns fragment1 ;
case 1 : // For tab 2
// Use fragment for tab 2
returns fragment2 ; case
2 : // For tab 3
// Use fragment for tab 3
gives fragment3; default
:
gives zero;
}
}

@Override
public int getCount() {
return 3; // count from tab
}

@Override
public CharSequence getPageTitle(int position) {
switch (position) {
case 0: // name for declaration Tab1
return Tab1;
case 1: // name for Tab2
return Tab2;
case 2 : // Header for Tab3returns Tab3;default:returns zero;}}}.

Solution No 6:

I had the same problem. This is how it worked for me.

Delete AppBarLayout layout_behavior so it is at the top. Set the layout behavior of the FrameLayout as app:layout_behavior=@string/appbar_scrolling_view_behavior to adjust the layout of the FrameLayout to that of the AppBarLayout. This way the content of your frame will scroll, but not the toolbar. The coordinate scheme is as follows

This is the XML format of your cutout, where scrolling does not affect the TabLayout format and the bottom line of the format.

I hope that helps somebody, thank you.

for more information –
Scrolling behaviour for Android appbars

Solution No 7:

This is not possible in a coordinate scheme. Therefore, use RelativeLayout and design your own layout in this software.

Solution No 8:

The best possible solution would be to create such a hierarchy.

Your layout allowed you to hide the toolbar during the interaction.

The other widgets must be placed in a fixed position.

Don’t forget to add

app:layout_behavior=@string/appbar_scrolling_view_behavior

the line above in the ViewGroup parent of your recording.

Let’s give an example of the approach I’m talking about.

So far, so good. Let’s take a look at the result.

Good luck!

Related Tags:

coordinatorlayout recyclerview scroll,collapsing toolbar'' android,coordinatorlayout nestedscrollview,collapsing toolbar with recyclerview android example,collapsing toolbar layout android example androidhive,appbar_scrolling_view_behavior not working,sticky button android,coordinatorlayout bottom button,codepath coordinatorlayout,android-coordinatorlayout scrollview,coordinator layout animation,coordinatorlayout androidx,coordinatorlayout pin to bottom,android-coordinatorlayout layout_below,coordinatorlayout anchor,set bottom in coordinatorlayout