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);
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 divide my screen into four parts and add activities in each part. I am not interested in using fragment. Each activity should behave independent of other. Attached photo is showing what I exactly want to do.
In each child activity I want to add VideoView or WebView depending on the selection from menu item.
How can I do it. I didn't find any way to add activity to an activity.
Thanks :)
PS: Activity means Activity not fragment.
i strongly recommend 'using fragments' in your case as ActivityGroup is deprecated in API 13..
The only way you can do it by using fragments. Here is the simple example on how to add multiple fragments on single activity Link
Edit link
You can achieve this design by using four fragments, one for each child view inside a single activity.
The recommended way is to create a single XML layout for your activity, and create four fragments inside that layout.
Whether it is possible one layout can be called by two activities.
Say i have a textview and a button.
1) Using one activity i set the textView with a name
2) Using another activity, is it possible to display popup message when i click the button.
first activity should set the textview alone and second activity should be called when i click the button. Because, i will get the text from api webservice call in first activity and will display message in popup window using another activity using some other api webservice call.
yes you can use one layout for two activities,but in that case where you use same controls for both activites:
like activity one:
uses both one textView and Button
like activity two:
uses both one textView and Button
Yes. Two activities don't care if they are using the same layout, and in fact don't really know about it. You can use view.setVisibility to make certain views invisible or visible, and as long as you are using the ids associated with the views can make different calls on them in the activities.
So the answer is yes, you can manipulate that layout however you like in two different activities.
No problem, you can easily use same layout file for more then one activity.
First try to implement this thing in your project, and then see, what happening.
Thanks,
Sumeet.
I'm new to Android and a confused about the options to group Views together.
Let's say I want to create a UI where I have 2 sections of controls (one with Buttons and one with text + Spinners) that are above each other in portrait mode and next to each other in landscape mode, and the same goes for the stuff within those sections. Obviously I would like to dynamically change this when the user changes from one mode to another.
So, do I use Fragments within Fragments or use them only the outer section and then a Compound Control for the inner elements? Or are Fragments even necessary and I should better stick to something else? What is the best practice here?
Thank you in advance!
In your example you would create two layout files. One that contained your buttons and the other that contained your spinners.
You would create a 3rd layout file for the portrait orientation and use the include tag to include your other layouts within the 3rd layout. Similarly for your landscape layout, you would include your inner UI layouts in that.
You could then use an Activity or a Fragment which would use only the main layouts and assuming they were placed into the correct layout folders, the fragment/activity would load the correct one based on your orientation.
Fragments within Fragments should be avoided unless you have a specific need for it. It works but in practice managing the lifecycle becomes tiresome.
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.