Android Question TypeFace and ListView

Discussion in 'Android Questions' started by MarcoRome, Feb 8, 2015.

  1. MarcoRome

    MarcoRome Expert Licensed User

    Hi all, i have this problem, when i change listview with characters different i have this effect:

    [​IMG]

    The original Code is this:
    Code:
    For i = 0 To COUNTRIES.Size - 1
                        m = COUNTRIES.Get(i)
                        
    'Setto Carattere
                        TimeFont =  Typeface.LoadFromAssets("jurassic.ttf")
                        ListView1.TwoLinesAndBitmap.Label.Typeface = TimeFont
                        ListView1.TwoLinesAndBitmap.Label.TextColor = 
    Colors.Black
                        ListView1.TwoLinesAndBitmap.Label.TextSize = 
    18dip
                      
                        ListView1.TwoLinesAndBitmap.SecondLabel.TextColor = 
    Colors.Black
                        ListView1.TwoLinesAndBitmap.SecondLabel.Typeface = 
    Typeface.DEFAULT
                        ListView1.FastScrollEnabled = 
    True
                        
    'ListView1.ScrollingBackgroundColor = Colors.black
                        'ListView1.Color = Colors.Black
                        ListView1.AddTwoLinesAndBitmap2(m.Get("genere"),"Totale: " & m.Get("totale") , LoadBitmap(File.DirAssets, m.Get("icona_barzelletta") ),  m.Get("genere")  )
                    
    Next
    the first row as you see have different TTF another row (2,3, etc ) work ( as you see into picture ).


    Second.. when i click top listview i have this code, and if you see i change TypeFace in stars.ttf:

    Code:
    For i = 0 To COUNTRIES.Size - 1
                        m = COUNTRIES.Get(i)
                        
    'Setto Carattere
                        ListView1.TwoLinesAndBitmap.Label.Typeface = Typeface.DEFAULT
                        ListView1.TwoLinesAndBitmap.Label.TextColor = 
    Colors.Black
                        ListView1.TwoLinesAndBitmap.Label.TextSize = 
    8dip
                        ListView1.TwoLinesAndBitmap.Label.Gravity = 
    Gravity.TOP
                      
                        TimeFont1 =  
    Typeface.LoadFromAssets("stars.ttf")
                        ListView1.TwoLinesAndBitmap.SecondLabel.Typeface = TimeFont1
                        ListView1.TwoLinesAndBitmap.SecondLabel.TextColor = 
    Colors.Red
                        ListView1.FastScrollEnabled = 
    True

                        ListView1.AddTwoLinesAndBitmap2(m.Get(
    "barzelletta"), m.Get("voto"), LoadBitmap(File.DirAssets, m.Get("icona_barzelletta") ),  m.Get("id")  )
    Next
    But ths result is this:

    [​IMG]

    also here the first row as you see have different TTF another row (2,3, etc ) work ( as you see into picture ).

    Any idea ??
    Thank you
    Marco
     
  2. Peter Simpson

    Peter Simpson Expert Licensed User

    Hello,
    What happens if you set the Typeface right after initializing the ListView1 and before you start the For Loop?

    Basically try taking the Typeface out of the For Loop.
     
  3. MarcoRome

    MarcoRome Expert Licensed User

    Hi Peter, yes i try in different mode:

    Code:
    Sub Globals
       
           
    'These global variables will be redeclared each time the activity is created.
           'These variables can only be accessed from this module.
                   
    ......
        
    Dim TimeFont, TimeFont1 As Typeface
        TimeFont =  
    Typeface.LoadFromAssets("jurassic.ttf")
        TimeFont1 =  
    Typeface.LoadFromAssets("stars.ttf")
    End Sub
     
     
     
    'Setto Carattere
    ListView1.TwoLinesAndBitmap.Label.Typeface = TimeFont
    ListView1.TwoLinesAndBitmap.Label.TextColor = 
    Colors.Black
    ListView1.TwoLinesAndBitmap.Label.TextSize = 
    18dip
    ListView1.TwoLinesAndBitmap.SecondLabel.TextColor = 
    Colors.Black
    ListView1.TwoLinesAndBitmap.SecondLabel.Typeface = 
    Typeface.DEFAULT
     
    For i = 0 To COUNTRIES.Size - 1
    m = COUNTRIES.Get(i)
    ListView1.FastScrollEnabled = 
    True
    ListView1.AddTwoLinesAndBitmap2(m.Get(
    "genere"),"Totale: " & m.Get("totale") , LoadBitmap(File.DirAssets, m.Get("icona_barzelletta") ), m.Get("genere") )
    Next
    but anyway same result.
    I solved using two Listview
    Thank you anyway
    Marco
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice