Android Question Tabhost icons size too small (sdkversion=26)

diego

Member
Licensed User
Longtime User
Hi, I've just added targetSdkVersion to 26 and all my layout changes because I had SDKtarget to 14 (I liked much more textbox appearence).

I have TabHost with icons and they are too small now. What should I do? I've tried to change IMG to 192x192, use LoadBitMapResize... and same result, the icons are very small in the tabs.

thanks in advance and sorry if this question is already done, I looked for similar topics for hours...
 

diego

Member
Licensed User
Longtime User
thanks for your reply, here is the tabhost before and after the targetsdkversion change:



(the 5th image is different because I tried with another icon too)
last image seems to be not shown, but the tab Text instead.

TabStripViewPager seems easy to use, but it's possible to add icons to the Tabs?
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
The 'before' image is from Android 2 theme.

This is how the TabHost should look on modern devices:

SS-2018-08-12_10.55.04.png


B4X:
Dim p As Panel
p.Initialize("")
Dim bmp As Bitmap = LoadBitmapResize(File.DirAssets, "baseline_settings_phone_black_48dp.png", 32dip, 32dip, True)
TabHost1.AddTabWithIcon2("", bmp, bmp, p)
TabHost1.AddTabWithIcon2("", bmp, bmp, p)
TabHost1.AddTabWithIcon2("", bmp, bmp, p)
TabHost1.AddTabWithIcon2("", bmp, bmp, p)

TabStripViewPager seems easy to use, but it's possible to add icons to the Tabs?
Yes: https://www.b4x.com/android/forum/threads/tabstripviewpager-with-fontawesome-material-icons.73885
If you want custom icons then you will need to use CSBuilder.Image.
 
Upvote 0

diego

Member
Licensed User
Longtime User
Thanks Erel, I'm trying both solutions. LoadBitmapResize+ 32dip, 32dip still no success... should I use folders \Objects\res\drawable\xxx\ ? I only put the image files on Files folder.

And with TabStrip + Fontawesome I don't like tab's size, with TabHost you can see all the tabs in the screen, but with TabStrip you need to hide some icons by moving left-right. Is there any way to minimize tab width to "1 char" (fontawesome icon)?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
should I use folders \Objects\res\drawable\xxx\ ?
No. Make sure that there is no extra transparent area around the image.


And with TabStrip + Fontawesome I don't like tab's size, with TabHost you can see all the tabs in the screen, but with TabStrip you need to hide some icons by moving left-right. Is there any way to minimize tab width to "1 char" (fontawesome icon)?
You should start a new thread for a new question.
 
Upvote 0
Top