I am new for android,I have a footer tab-layout i want that tab layout to be present in all the activities it should be fixed, once going to the new activities or fragments it shouldn't be created again(shouldn't appear that it created then on reaching that activity or fragment). How should i achieve this? I surfed many related question but none matches my requirement. Kindly help me with this. Sample image . i want to achieve something like the sample image.
-
You can use only one activity, with two fragmetns, one for the footer. – Gilberto Ibarra Feb 20 '16 at 05:54
4 Answers
You could try having one activity and simply switching out fragments for the "content" area.
Otherwise you have to save the state of the footer and make it again in every activity. To have it feel seamless you can remove the transition animation between activities.
-
-
@mohamedrefak edited answer http://stackoverflow.com/questions/6972295/switching-activities-without-animation – dcow Feb 20 '16 at 05:56
Make a footer layout file and then use include
in all layout file you want to display that footer,
<include layout="@layout/footer" />
use weightSum
to manage height of footer in all screen

- 22,772
- 22
- 86
- 142
You can also use a FragmentTabHost. By default the tabs are shown above the screen, which is recommended by android. You can bring it down. Here and here are some examples.
You need to call the setup()
method of the FragmentTabHost
to initialise it. The content are is loaded as fragments. Use newTabSpec()
method to add tabs to it.

- 6,768
- 3
- 24
- 33
Just simple design one fragmenet and wherever you want you can put it in xml, the click events can be defined in that Fragment globally:) –