3

I am developing an application for Android (2.2) in Eclipse.

My App has a TabWidget, within this 5 tabs.

TabHost: (tab1) (tab2) (tab3) (tab4) (tab5)

Beneath the Tabs is the content of the tabs (just simple elements, like Buttons, texts and so on).

In the Outline-Window I can see the "tabcontent", along with my frames inside. The Tab is also working correctly in the app, when I click it in the COMPILED app, the apropriate tab shows.

My question is now:

How can I make the graphical designer to show me the sub-tabs along with their content?

If I open the designer, I see the tabhost with my first screen, but when I try to click the tabs in the designer, It does not show me the other tab-contents (tab 2-5).

The layouts for the tabs are static,IN the XMl-File, so the designer "sees" them in the Outline>>TabContent - Window.

Like, in tab 5 there is the text "this app was programmed by", and I would like to preview this in the designer and be able to edit the text / layout there.

Is there any Hotkey perhaps? Or Menu-Option? (clicking on the TabWidget gets me the properties of the TabWidget, bit there seems no option to show any other tab than the first one)

Jeff Axelrod
  • 27,676
  • 31
  • 147
  • 246

2 Answers2

9

After playing around in Eclipse I found a way to preview what's in a tab visually using the "Graphical Layout" tab of the xml file.

  1. Open the graphical layout editor (not xml text)
  2. Open your "Outline" view in Eclipse
  3. Expand tabhost, to get to tabcontent
  4. Select the tab you wish to view/edit
  5. Drag the tab so it becomes the first element right under tabcontent
  6. Your view should update to show that tabs elements
  7. After you finish editing, just re-order everything the way you wanted

This does not remove the requirement of properly configuring your tabs in your activity/java files when you want to run your app in the simulator or on a device.

Jeff Axelrod
  • 27,676
  • 31
  • 147
  • 246
user1202888
  • 1,043
  • 2
  • 11
  • 19
  • THis also works in Android Studio. My version is 4.1 . That "Outline" view in Eclipse is similar with "Component tree" in AS. You can see it on the side, activate it. – mihai71 Nov 09 '20 at 06:48
  • continuation while working. I've noticed something ugly. When I move one layout from 3rd position to first, the layouts inside are mixing... for example the first layout becomes first... so I dragged the first tab to the last position, but it also mixes layouts inside... i think i will move manually tabs so I can preview Design ... but it's ok because you can use "Collapse" to see code easily. – mihai71 Nov 09 '20 at 06:56
0

I could be wrong, but I don't think it's possible. The graphic layout editor is pretty limited. You are better off writing the xml and then testing on an emulator or physical device.

skynet
  • 9,898
  • 5
  • 43
  • 52