FadingActionBar icon indicating copy to clipboard operation
FadingActionBar copied to clipboard

FadingActionBar with FragmentTabHost

Open vishwasdoth opened this issue 9 years ago • 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.

vishwasdoth avatar Apr 14 '15 19:04 vishwasdoth

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).

manaqvi avatar Apr 21 '15 11:04 manaqvi

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?

vishwasdoth avatar Apr 22 '15 10:04 vishwasdoth

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

vishwasdoth avatar May 06 '15 16:05 vishwasdoth