Android Question Curious Tabhost

ciginfo

Well-Known Member
Licensed User
Longtime User
Hi,
Why I do not get the same result in TABHOST when I am using exactly the same code in 2 different projects.
Pictures exist in the two different "Files" folders.
In one project, with AddTabWithIcon I get the text + image, in other project I only get the text with larger characters and which do not contain on the same line.
B4X:
    Dim Bmp1_scale, Bmp2_scale, Bmp1_chord, Bmp2_chord, Bmp1_modal, Bmp2_modal, Bmp1_tonalite, Bmp2_tonalite, Bmp1_quid, Bmp2_quid As Bitmap
    
    Bmp1_scale = LoadBitmap(File.DirAssets, "gammes1.png")
    Bmp2_scale = LoadBitmap(File.DirAssets, "gammes2.png")
    Bmp1_chord  = LoadBitmap(File.DirAssets, "accords1.png")
    Bmp2_chord  = LoadBitmap(File.DirAssets, "accords2.png")
    Bmp1_modal  = LoadBitmap(File.DirAssets, "modal1.png")
    Bmp2_modal  = LoadBitmap(File.DirAssets, "modal2.png")
    Bmp1_tonalite  = LoadBitmap(File.DirAssets, "tonalite1.png")
    Bmp2_tonalite  = LoadBitmap(File.DirAssets, "tonalite2.png")
    Bmp1_quid  = LoadBitmap(File.DirAssets, "quid1.png")
    Bmp2_quid  = LoadBitmap(File.DirAssets, "quid2.png")

    TabHost1.AddTabWithIcon ("Scales", Bmp1_scale, Bmp2_scale, "Main")
    TabHost1.AddTabWithIcon ("Chord", Bmp1_chord, Bmp2_chord, "Chords")
    TabHost1.AddTabWithIcon ("Modal", Bmp1_modal, Bmp2_modal, "Modal")
     TabHost1.AddTabWithIcon ("Tons", Bmp1_tonalite, Bmp2_tonalite, "tonalite")
    TabHost1.AddTabWithIcon ("Quid", Bmp1_quid, Bmp2_quid, "Quid")

Look at attach files. Thank you
 

Attachments

  • Tab1.png
    Tab1.png
    39.2 KB · Views: 275
  • Tab2.png
    Tab2.png
    58.9 KB · Views: 295

mcqueccu

Well-Known Member
Licensed User
Longtime User
Check your manifest - the minimum sdk is set differently for the two projects thats why, so to achieve the same result, make sure their manifest also match.
Tab 1 Picture is using lower minimum sdk like 5 whiles Tab 2 is using something higher
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
As a side note ... give consideration to follow @Erels recommendation to change to TabStripViewPager

 
Upvote 0

ciginfo

Well-Known Member
Licensed User
Longtime User
Check your manifest - the minimum sdk is set differently for the two projects thats why, so to achieve the same result, make sure their manifest also match.
Tab 1 Picture is using lower minimum sdk like 5 whiles Tab 2 is using something higher
Here the two manifests, I don't see the difference
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="4" />
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="29"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")
'End of default text.
 
Upvote 0

ciginfo

Well-Known Member
Licensed User
Longtime User
As a side note ... give consideration to follow @Erels recommendation to change to TabStripViewPager

Ok, but is it possible to add pictogram, & how?
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
Ok, but is it possible to add pictogram, & how?

I have no Idea ... I would presume if you can add it to TabHost you could also do so with TabStripViewPager.

Ask the question & find out.
 
Upvote 0
Top