Tabhost and the panels added to it?

boten

Active Member
Licensed User
Longtime User
I want to put 3 scrollviews on a tabhost with 3 tabs.
I add 3 panels to the tabhost and put a scrollview on each of the 3 panels.

I'm using reflector (thx Informatix) to get the actual size of each panel in order to addview of the SV's.

The problem is that ONLY the 1st panel "reports" its size, so only the first SV is shown.

What's the difference between the 1st panel added to TabHost and the 2nd, 3rd....???

See attached sample project
 

Attachments

  • sv3.zip
    6.2 KB · Views: 307

boten

Active Member
Licensed User
Longtime User
I'd like NOT to use the designer, but anyway - 100%y is more than the tabhost "available space" , as the tabs and their titles take up some of the %y

reason is:

I have a class that has a private member of your table class.

the class produces a large variable number of items to be shown using your fast table view.

I modified your Sub AddtoActivity so it accpets a panel and uses the panel sizes as the SV sizes. (SV fills the panel)

In your table class you rely on SV.Height to determine hide/show row.

I need several instances of my class, each on a tab, hence I have several instances of table class, each within an instance of my class.

Panels passed to tabhost (without designer) do not have width/height so I use reflector. But it works only on the first tab/panel

I need to know the exact sizes of the panel passed to tabhost, as i want to be able to use SV.Height
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
but anyway - 100%y is more than the tabhost "available space" , as the tabs and their titles take up some of the %y
That is not correct.

See this screenshot (you can see the tab size based on the blue corners):

SS-2013-01-09_13.22.58.png


This is the designer script:
B4X:
Panel1.SetLeftAndRight(0, 100%x)
Panel1.SetTopAndBottom(0, 100%y)
 
Upvote 0

boten

Active Member
Licensed User
Longtime User
OK, got your point. Now the other issue is that I want to use the ENTIRE tabhost "real estate", so I use TabHostExtra

B4X:
tbx.setTabHeight(tbh,30dip)
tbx.setTabHostPadding(tbh,0,0,0,0)
tbx.setTabContentViewPadding(tbh,0,0,0,0)

Now there are noticable margins around the scrollview (see attached pic).
How do I get to use the entire space (after tabhostextra)?

(attached a sample project)
 

Attachments

  • scr.png
    scr.png
    33 KB · Views: 333
  • desig.zip
    6.9 KB · Views: 286
Upvote 0

boten

Active Member
Licensed User
Longtime User
Right. The solution I use is
A) get the "current" TabHeight, TabHostPadding & TabContentViewPadding
B) compute the "extra space" gained by "future" TabHeight, TabHostPadding & TabContentViewPadding
C) increase the inner panel width & height by that extra space
D) set (apply) the new TabHeight, TabHostPadding & TabContentViewPadding
 
Upvote 0
Top