Android Tutorial TabHost tutorial

Status
Not open for further replies.

Steve Miller

Active Member
Licensed User
Longtime User
Is it possible to change the icon on the tab after it's been loaded? For instance, when a user finishes entering information in Tab1 and they go on to Tab2, I'd like to load a checkmark icon on Tab1 showing they finished that tab.

Possible?
 

arjian

Member
Licensed User
Longtime User
When i add a Layout in tabhost It doesn’t display width of views completely as shown in the attached file, I have to shift them 11dip to the left or there is a simple way, how can I fix it?
 

Attachments

  • TabHost.png
    28.5 KB · Views: 816

arjian

Member
Licensed User
Longtime User
How are you building the layout?

You should build it with the designer and call lbl.SetLeftAndRight(0, 100%x) in the designer script.

Load the layout file with TabHost.AddTab.


I build it with the designer and load it with TabHost.AddTab method

But I didn’t set there’s position in the designer script because I set them by code as shown in the attached files
 

Attachments

  • 1.PNG
    12.7 KB · Views: 629
  • 2.PNG
    38.6 KB · Views: 625
Last edited:

arjian

Member
Licensed User
Longtime User
You will need to implement it with the designer.

that is not the way i was expected, sometimes the view's position is dependent to the variables in code ,so i have to shift views 11dip to the left
,Scrollview has this problem too
 

Steve Miller

Active Member
Licensed User
Longtime User
Is it possible to get the previous tab? So, if I am on tab1 and I click on tab3, is there a way to find out I was on tab1 prior to the current tab (which is now tab3)?
 

Sytek

Active Member
Licensed User
Longtime User
Google design guide recommended it. Note that in Android 4+ TabHost doesn't show icons if there is also text.

I think that there is a solution for showing Tabs at the bottom. Try to search the forum.
This should be sticky...At the moment.
Best Regards!
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
You can use a global variable to store the current selected tab and update it in TabChanged event. This will allow you to know the previous selected tab.

I just use the TabHost's .Tag property to store the .CurrentTab - which of course becomes the previous tab when the TabChanged event is triggered:

B4X:
Sub TabHost_TabChanged
    Log("Previous Tab: " & TabHost.Tag)
    TabHost.Tag = TabHost.CurrentTab
End Sub
 

Dadeda

Member
Licensed User
Longtime User
This lib is great, but, you have the selected/unselected tab using a bitmap ok...but i'm not using bitmaps, only text with gradient from tabhostextra wich is great, how could i do the same selected/unselect tab without bitmaps just colors of tab background and text color?
 

merlin2049er

Well-Known Member
Licensed User
Longtime User
hmm, I've got one app that's asking for me to initalize tabhost (and crashing, but it's loaded as a layout) , and the other app is fine.
Not sure what gives.
 

merlin2049er

Well-Known Member
Licensed User
Longtime User
It's ok now. In the globals...

B4X:
dim tb as tabhost
changed it to
B4X:
dim tabhost1 as tabhost
 

Rob Rendle

Member
Licensed User
Longtime User
Hi,

How do you remove the blue line that is under the tab (when selected) and also the blue line that is the same width as the TabHost?
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…