ManuelPeinado/FadingActionBar

FadingActionBar with FragmentTabHost

vishwasdoth opened this issue · 3 comments

Can I use FadingActionBar with FragmentTabHost?

I have FragmentTabHost with three Fragments and each has ListView. Above Fragment tabs, I have header layout which I want to parallax hide on ListView scroll.

Yes. It can be possible by placing header layout (where you want parallax effect) within parent fragment which is in your case is "FragmentTabHost". then you can simply make effect using this:

                     FadingActionBarHelper mFadingHelper = new FadingActionBarHelper()
                     .actionBarBackground(R.drawable.ab_background_light)
                     .headerLayout(R.layout.header)
                     .contentLayout(R.layout.fragment_tab_host)
                     .lightActionBar(true);

Note: make sure your three listview fragments are in fragment_tab_host's java class. even a better approach to use a viewpager within FragmentTabHost to hold all three fragment (List fragments).

Thanks for your response. I am not getting one thing here. What do you mean by "Note: make sure your three listview fragments are in fragment_tab_host's java class."

Here is my setup...
mTabHost = (FragmentTabHost) findViewById(android.R.id.tabhost);
mTabHost.setup(getActivity(), getChildFragmentManager(), R.id.tab_fragments_holder);

mTabHost.addTab(tabSpec, Fragment1.class, args);
mTabHost.addTab(tabSpec, Fragment2.class, args);
mTabHost.addTab(tabSpec, Fragment3.class, args);

each fragment has different layout file.. like fragment_layout1.xml, fragment_layout2.xml

is this setup correct?

I am still stuck on this. Any help would be great help.