Layout Tabhost

Base

Member
Licensed User
Longtime User
Hi all,

In my project i use the tabhost object and add some tabs to it, using the code.
Works fine, the tabhost object is created and the tabs are added. However the layout looks not like i expected: the tabobject and it's tabs are orange.

It looks like this but worser and under the tabs which are not selected there is an orange line.



I would like to have a professional tabhost layout, like this:



Or this:



I tried to use the Reflection library and it changes the layout but unfortunately not like the examples like above.

Does anyone know how to do this?

Thanks for any information.

Base
 

eps

Expert
Licensed User
Longtime User
Have you looked here?

http://www.b4x.com/forum/basic4andr...utorials/6721-tabhost-tutorial.html#post39038

In the first code excerpt it has LoadTabWithBmp or similar, which you should use. I would also suggest looking at the code example on the bottom of the first post as well.

B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("main")
[B]    Dim bmp1, bmp2 As Bitmap
    bmp1 = LoadBitmap(File.DirAssets, "ic.png")
    bmp2 = LoadBitmap(File.DirAssets, "ic_selected.png")[/B]    

[B]    TabHost1.AddTabWithIcon ("Name", bmp1, bmp2, "page1") 'load the layout file of each page[/B]
    TabHost1.AddTab("Color", "page2") 
    TabHost1.AddTab("Animal", "page3")
End Sub

I think there's a background colour somewhere, which you need to adjust.. i.e. like here : http://www.b4x.com/forum/basic4android-share-your-creations/9874-motorsport-calendar.html

If you still can't find it - look on the Designer, under Tabhost, let me know and I will look at it for you.. The example Tabhost has the background in grey.. (linked from first link above)
 
Last edited:
Upvote 0

Base

Member
Licensed User
Longtime User
Hi eps,

Thanks for your information.
I can remember i tried that as well.
But tonight i will try it again and i will post the result tomorrow.

Regards,

Base
 
Upvote 0

Base

Member
Licensed User
Longtime User
Hi eps,

Thanks for your information.
I can remember i tried that as well.
But tonight i will try it again and i will post the result tomorrow.

Regards,

Base

Hi eps,

I don't get it.
I tried the example and read your calendar thread.
With the example i'll keep orange tabs.

I did a little bit of investigation and noticed something:

My Samsung Galaxy Gio shows the tabs on the tabhost in orange.
A Samsung Galaxy S shows the tabs on the tabhost from the same app in blue.

So, it depends on the device in which color the tabhost is shown.

But there must be a way to give the tabhost with his tabs one (grey ie) color for all devices??

Regards,

Base
 
Upvote 0

Base

Member
Licensed User
Longtime User

Ok, now i downloaded your app (the motorsport calendar) and even in your app the tabs are orange.
I also use Runkeeper on my device and their tabs are customized but how?
 
Upvote 0

eps

Expert
Licensed User
Longtime User
Didn't know that! I've only tried my App on both my devices and they are both grey.

Will need to investigate a little more..
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…