Android Question MeasureStringWidth with csBuilder

Discussion in 'Android Questions' started by fbritop, Mar 25, 2019.

  1. fbritop

    fbritop Active Member Licensed User

    Is there an alternative way to calculate the label width with different typeface?


    l3.width=cv.MeasureStringWidth(cs, fontNormal, Starter.subTitleSize)
    I have to go two times to actually get the FONTAWESOME and the fontNormal width´s in order to get the total width. With this method FONTAWESOME are not being considered.

  2. Erel

    Erel Administrator Staff Member Licensed User

    Canvas.MeasureStringWidth expects a string, not a CharSequence (CSBuilder). It will ignore the string attributes.

    I guess that the simplest solution will be to add a small gap as a compensation for this.
  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