Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 621
TimCS Avatar asked Dec 15 '11 07:12

TimCS


1 Answers

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.

like image 173
kaspermoerch Avatar answered Sep 23 '22 18:09

kaspermoerch