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.
Related
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.
I want to display For each and every tab different layout so what a easy way to display
Create different layout and add or merge in.
Create only one layout for different tab and set visiblity to gone and visible.
Which one is easy way or other way please tell me.
Here attached screen: http://screencast.com/t/pEhf8g0b
Create XML's for each tab, for example education.xml, activities.xml, and in the onCreate call that layout, for example in Education onCreate() call setContentView(R.layout.education); and for Activities call setContentView(R.layout.activities);
I want to create a tab menu similar to TabHost but I would like to use some other elements, not only buttons in that menu, and also be able to bind some other actions than start new activity to buttons.
Basically I need an activity with a layout that I will be able to show in part of every other activity just like TabHost with ActivityGroup. Is it possible at all? Ask me if you didn't understand my idea.
how about using a horizontal scrollview that has a linear layout (with horizontal orientation) , which has all the views that you've mentioned?
beneath it , put a fragment container which can change its content.
if you are unfamiliar with fragments , check the api-demos , or , for "old" versions of android (gingerbread and below) , check the support library demos (v4) .
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
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.