I have nine tabs(say 0 to 8), displaying only five tabs on screen.
The five tabs will be 0 to 3 of those nine tabs and fifth tab will be MORE Tab.
MORE tab will show Activity with GridView showing Image+Title of remaining nine tabs(say 4 to 8).
Now on click of any item(Image+Title) in GridView will replace the MORE Tab Image+Title and its content/activity with its respective activity.
I am able to replace the tab indicators(Image+Title) but struggling on replace its respective content/activity.
As on other similar thread they had suggested to use clearAllTabs and add/recreate require tabs again. But i feel clearing all tabs just to replace one tab is heavy.
I am using the TabActivity with Intents. As i know TabActivity is deprecated by its old app initially it had only 5 tabs but now requirement is to add few more tabs.
Need your help to implement this. If it not possible with TabActivity, then switching to fragment tabs does it help me?
I trying to implemtent this Image
I would recommend fragments for sure. I've used TabHost in the past and it was very problematic.
You can simply have Button at the top that control the visibility of the fragment below. With this way, you'll even be able to add transitions.
This link give a little more information on that topic. Separate Back Stack for each tab in Android using Fragments
Related
I have implemented an ActionBar with 3 tabs in an android app. I also used ViewPager to switch between different tabs. Every tab is defined in a fragment.
The last tab is called "Setting". I have two different settings. One is "Simple" setting, and the other one is "Advanced" setting. How can I implement these two different settings in the "Setting" tab. Should I make kind of sub-fragments or two new tabs inside the main tab which is "Setting" tab? Can I also for example create two buttons at the top, and switch between them? Or any better idea? Which solution is easier and more efficient. I'm a newbie in Android.
I want to make something like this:
Hope this help
Take SettingFragment as Host fragment
Place both buttons on top and ViewPager below buttons
Take SimpleFragment and AdvanceFragment as items in ViewPager
I am facing problem in designing following scenario :
Showing 3 tabs for contact-lists (all, friends and family)
All tabs would contain contact-list as per the groups
Any contact could be selected and viewed but should be in the same tab (either all,family or frnds)
In short, tabs should be available globally.
Here, I decided to use ActionBar and to change the view by using fragments to be called from onTabSelected() of TabListener; in which I was confused as I have to keep only single activity but multiple fragments.
'Keeping single activity' is this a standard / valid approach ? Please suggest.
Thanks in advance.
You should have a single Activity and have a container(could be an empty LinearLayout) in which fragments are replaced depending on the tab selected.
I know this is late, but I used a tabhost with fragments to do something similar. Here's a nice tutorial.
http://thepseudocoder.wordpress.com/2011/10/04/android-tabs-the-fragment-way/
I'm currently developing an application that has a tab bar, and 3
different views: the first is a master-detail, the second one a
gallery, the third is a simple webview.
I was using the TabActivity, but since Android 3.0, this class is
deprecated and Android reference
suggests to use Fragments.
I switched then to an ActionBar, with Tabs and Action
Items. Inseide the first tab item I have a layout with 2 fragments (my
master-detail view). When I switch through tabs I want that my layout
change as I described above, so I thought to hide the left fragment
(the master listview) and work only in the detail fragment.. but with
this solution I have only one main activity with a lot of fragments
attached to it, and for each fragment displayed I need to modify the
Action Item shown and handle different actions in
OnOptionItemSelected.
Is this a good way to implement this kind of
application or should I consider different solutions?
You should have a single fragment container where the fragments are replaced depending on the tab selected.
One activity and multiple fragments is the right approach.
I try to create a android application with tabHost and I would like to avoid to set intent(activity) for the content of these tabs.
I succeed to create my tabMenu but I would like to change the view of one tab.
How I can do that ?
For example I have one view for Tab1 and two views for Tab2 (when the user click on the button of Tab2_view1 then the content change to Tab2_view2 and the indicator doesn't change (stay on "tab2")).
I hope it is possible but I don't find the way to do that without using different activities for each tabs.
Maybe my conception is bad (I am novice in Android dev.)...
Thank you very much for your help,
Fred
Android has ActivityGroup for the same purpose that you are looking for. By using ActivityGroup you can show multiple views in a single Tab by maintaining the stack of the Views.
ActivityGroup Example 1
ActivityGroup Example 2
Fragment - Answer to me by hackbod
I am developing an application in android for which i have to use nine tabs in the main layout.
But all tabs in one view doesn't look nice.So i decided to show five tabs in one view and other four on click of one of the tabs.But it is not working when i click the fifth tab to show the other four tabs can you suggest me to set all tabs in my application in a better gui.
Thanx in Advance