0

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.

4 Answers4

0

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.

Community
  • 1
  • 1
dcow
  • 7,765
  • 3
  • 45
  • 65
0

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

Amit Vaghela
  • 22,772
  • 22
  • 86
  • 142
0

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.

K Neeraj Lal
  • 6,768
  • 3
  • 24
  • 33
0

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:) –