Using ViewFlipper inside TabHost - android

I am using TabHost in my application.
When I click on any one of the TabHost, it will display corresponding activity.
What I want is when i swipe on that activity it should display another Activity
I have used a ViewFlipper in the Activity(ChildActivity).
I am using example given here ....
The problem is : Its displaying the Activity that is loaded initially. Its not flipping the views as i wanted.

You can check out the code used in the Google I/O scheduler app. It has a class called FlingableTabHost. You would not need a ViewFlipper for this.
http://code.google.com/p/iosched/source/browse/trunk/src/com/google/android/apps/iosched/ui/ScheduleActivity.java

I would just catch the swipe on the tab's activity and then programmatically change the tab. Dont mess with something inside the tab.
Also, using viewFlippers, maybe you dont needs tabs.
Android Gestures
Swipe Action

Related

How to implement horizontal view android studio

im trying to implement an android aplication when your activity, cointains 3 or more 'main windows' like in the image -> 'A'. 'B'.'C'. so how is posible make when you slide you touch screen change from A, to B, for example, i was thinkin in a horizontal view, and inside of each item use a relative layout, but im not sure, its my first time with this kind of problem, thanks.
Try using android ViewPager. Each ImageView would be inside a Fragment that would reside inside your Activity. Check out this example
Use Tabbed Activity template when you want to make this type of Activity. ViewPager, Adapter and tab layout will be automatically implemented for you. Just make small changes in your Adapter according to your needs and use one Fragment for one tab and you can create as many tabs as you want in an Activity.
If you want i will post an example of an Adapter as i just implemented an Activity with 3 tabs.
To get your basics strong on ViewPager, tab layout and Fragment sections adapter read out this link.

Android creating a TabHost + ViewPager combo UI

I've been just looking at the demo and code for the ViewPager class in the android compatibility library; http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/index.html
What I want to create is;
A TabHost with tabs.
Each tab displays a List.
When an item in the List is selected it starts a new Activity.
The new Activity slides in to the space that the List was in, so the tabs are still visible.
Pressing the back button removes the new Activity and displays the original List.
I read about using an ActivityGroup but that class is deprecated so I refuse to use it.
I've looked at the Fragement demo examples for ViewPager and TabHost and feel like I'm looking for a combination of both of those things, but I'm a bit stuck on if it's even possible to do?
Thanks!
I've found a way to do this using ViewFlipper inside a tab. Then using custom in and out animations to slide between views.

add dynamic view to android tabhost

How can I add a dynamic view in a TabHost.
I have two tabs i.e. TabA and TabB. In TabA, I have 2 buttons and I want to set the layout (I have 2 different XML layout's) of TabB, depending upon the button pressed in TabA.
Can anyone help me.
Thank you!
That depends on the implementation of your TabHost. Have you used Activities or Views as Tabs?
Generally in your TabActivity you could use getTabHost().getTabWidget().getChildAt(index) or another method to get the view of a Tab.
If you use Activities as the children, you could also start a new Intent with your ActivityGroup and set a new view within the onCreate() method.
If you have problems finding examples for ActivityGroups with TabHosts, I can provide you a code sample showing you how to do it and also how to change the view within another tab by clicking a button.

Tab layout inside Tab layout

i have develop one application in which tab layout in main file now i would like to set tablayout inside 2nd number tab,so what thing can i do? help me.
its "tab inside tab"
I think you want to give sub-options while clicking on 2nd tab button. For that, why dont you create layout with 2-3 options as you wants. And make it visible/invisible based on the 2nd button's click.
You can make visible/invisible any view by using setVisibility(View.VISIBLE) and setVisibility(View.GONE) method.
I suppose you can't embed a TabHost inside another TabHost. You can do what #Paresh said. Implement your own view switching. If you want an entire Activity embedded - take a look at ActivityGroup or the Fragments framework which you can use through the Compatibility Framework. Good luck.

TabWidget problem with new activities

I use Tab Widget like in documentation example TabWidget
I have two tabs, and in every tab when I press some button I need to load another different activity. My question is how to achive that I have that two tab on another activities like headers ?
I could create that tabs in new activities but it wouldn't remember choosen activity for another tab. How to solve this ?
This is not possible out of the box. The normal TabHost doesn't provide any facility to change the content of a tab after it is created. If you can use views as your tab content, you can, however, flip between the views within a tab so that to get the effect you are after.
If you absolutely must use a new Activity, then you will have to implement your own TabHost which allows swapping tab content after it is created.

Categories

Resources