How to switch or change between the tabs in android sdk graphical layout?
Asked Answered
B

3

7

I am trying to change or switch between two tabs that I have within the eclipse graphical layout so that I can see the elements on the other tab. Is this possible? the only way I could see of doing this is to make the second tab, briefly be the first as that is what is shown when viewing the layout this way.

Sorry if this question has been asked before but I have searched on Google and here before I posted.

Bibliofilm answered 15/12, 2011 at 7:23 Comment(0)
H
8

What you could do is move each tabcontent to it's own XML file - lets say: tab1.xml and tab2.xml.

Then where you added them in your layout with the TabHost and TabWidget, you use the include tag instead:

<include layout="@layout/tab1" />       
<include layout="@layout/tab2" />

This way you will be able to view the each Tab as its own layout and don't have to worry about switching tabs in the graphical layout editor.

Hoenir answered 15/12, 2011 at 9:0 Comment(5)
Kasper thank you for your reply. Where do these include statements? are these under the frame layout?. Also the tab1/2.xml files are these full layout xml files?Bibliofilm
tab1 and tab2 are full layout files yes. I assumed, since you talked about swithing the tab viewed in the graphical layout editor that you added the layout to each tab in your XML file - so the includes would replace that.Hoenir
Kasper - thanks again for the reply, the tabs are currently in one layout so I have two relative layouts under the frame layout. Would I put the include statements in the place of these two tabs within the frame layout?Bibliofilm
Yes. If you have the FrameLayout with two RelativeLayout as children, you would move each of the RelativeLayouts into their own XML-file replacing them in the FrameLayout with the <include> tag.Hoenir
Kasper that has worked - thank you again for this. You learn new things everyday!Bibliofilm
D
0

As I know there is no way to change selected tab there - neither other views - check boxes for example. Only possibility is to change params and see for result.

Deoxyribonuclease answered 15/12, 2011 at 7:39 Comment(0)
K
-2

Ok, so I was wrong to understand the question..you can drag the panel of elements and put wherever you want...

If this is not the answer, please specify in detail what do you want to know exactly

Kanya answered 15/12, 2011 at 7:27 Comment(2)
Question is about graphical layout in eclipseDeoxyribonuclease
Shalin , thank you for your reply , I will try to move the elements as suggested but I did try and move the tab in question up but it just made a mess.Bibliofilm

© 2022 - 2024 — McMap. All rights reserved.