Adjust tab button height?

mistermentality

Active Member
Licensed User
Longtime User
It may be a daft question but the tabs themselves are quite big, is there a way to make the tab button (not the view just the tab part at the top) smaller in height?

Dave
 

nfordbscndrd

Well-Known Member
Licensed User
Longtime User
It may be a daft question but the tabs themselves are quite big, is there a way to make the tab button (not the view just the tab part at the top) smaller in height?

I had this same type of question before. One thing to remember (which I was overlooking) is that the default emulator size on your computer's monitor is quite large, making the tabs, buttons, etc., look overly large. When it is installed on an actual 3"-4" device, they no longer look so big.

The problem is that they still take up a relatively large amount of the screen space on small devices. This can be helped some by clicking on Project, Activity Properties, and select Full Screen and deselect Show Title.

That being said, I have used apps on the iPhone 4 which have very small buttons, lines of text choices, etc., and even with my huge hands I never have any problem selecting the right items, so I'm not 100% convinced that the large minimum size of buttons/tabs we are dealing with here are absolutely necessary on Android either. Seems like they could be allowed to go smaller and at least give us the option. I don't know if this is a limitation imposed by Android or just B4A.
 
Upvote 0

mistermentality

Active Member
Licensed User
Longtime User
Thank you for the replies, I see now why they are large (I only have a small screen phone). I shall try to find out how to make the app different sizes for different phones and test via an emulator as my next task is to adapt the app display to the available size as currently all my apps are for 320x480.

Thank you again :)

Dave
 
Upvote 0

nfordbscndrd

Well-Known Member
Licensed User
Longtime User
I shall try to find out how to make the app different sizes for different phones and test via an emulator as my next task is to adapt the app display to the available size as currently all my apps are for 320x480.

I had a lot of trouble wrapping my mind around the different screen sizes, pixel resolutions, and density (1 vs 1.5).

The program I'm working on has to run in landscape mode, so at least I didn't have to try to get everything to fit in portrait mode. I created layouts for 800x480x240, 800x480x160, and 480x320x160, then I put this code at the start of Activity_Create:

B4X:
Dim dens As Float
dens = Density
 
Dim lv As LayoutValues
lv = GetDeviceLayoutValues
 
If lv.Width > 599 Then
    LayoutWidth = 800
    If dens = 1.5 Then
        Activity.LoadLayout("800x480x240")
    Else
        Activity.LoadLayout("800x480x160")
    End If
Else
    LayoutWidth = 480
    Activity.LoadLayout("480x320x160")
End If

I made a few other adjustments as well, but the above was the main thing. Note that if a device has a resolution higher than 800x480, the 800x480x240 layout will be used and Android will adjust it to fit the device (supposedly).

I wouldn't swear that the above approach is the best, but it seems to work and it was the best *I* could come up with.

While I'm at it, here are some common devices and their resolutions and sizes:

Galaxy Tab: 7", 1024x600
generic 10": 1024x600
Xoom: 10.1", 1280x800
Motorola Defy: 3.7", 854x480
Galaxy SGS: 4", 800x480
Archos A70: 7", 800x480.
 
Last edited:
Upvote 0

mistermentality

Active Member
Licensed User
Longtime User
Thank you :)

Been busy trying lots of different things out in B4A and the idea of screen resolution is something I really want to figure out as my only android device is a 320x480 phone so what you posted is definitely appreciated.

Dave
 
Upvote 0

metrick

Active Member
Licensed User
Longtime User
Not sure if there is a way to control the constant size of the Tabhost.
eg. by just keep adding tabhost.addtab("TitleX", "PageX") the tab is getting smaller and smaller. Add about 7 pages to see it. Tabhost is only good for 3-4 tabs to fit fingers size
 
Upvote 0

Kim Rowden

Member
Licensed User
Longtime User
B4X:
Dim dens As Float
dens = Density

Dim lv As LayoutValues
lv = GetDeviceLayoutValues
 
If lv.Width > 599 Then
    LayoutWidth = 800
    If dens = 1.5 Then
        Activity.LoadLayout("800x480x240")
    Else
        Activity.LoadLayout("800x480x160")
    End If
Else
    LayoutWidth = 480
    Activity.LoadLayout("480x320x160")
End If

@nfordbscndrd:
I'm coming up to speed on B4A and the layout issues... Thank you for the above snippet - very helpful.
I was wondering why you were saving "LayoutWidth"? Is there a special reason for using it later?

Thanks,
-Kim
 
Upvote 0
Top