Android textview html font size tag

后端 未结 3 2030
盖世英雄少女心
盖世英雄少女心 2021-02-01 03:35

I use tag in android textview like this

resultTextView.setText(Html.fromHtml(\"T         


        
相关标签:
3条回答
  • 2021-02-01 03:45

    If you need only different size, you can use simple <small> or <big> and you can use it more times for one char.
    Example: "clasic text is ok, but <big>bigger <big>is <big> better</big></big></big>" You can use <h1> etc. too, but here is problem with margins.

    0 讨论(0)
  • 2021-02-01 03:50

    Try this one,Its working for me,use small,big key words

    TextView mBox = (TextView) findViewById(R.id.txt);
        mBox.setText(Html.fromHtml("<font color=#cc0029>" + "<b>"
                + "Hiiiiiiiiii" + "</b>" + "<br />" + "<small>" + "description"
                + "</small>" + "<br />" + "<small>" + "DateAdded" + "</small>"));
    
    0 讨论(0)
  • 2021-02-01 03:58

    There is exact question Using size HTML attribute in TextView . It says it ignores the size. You can use use <small> for smaller text and so on. <font> only supports color and face attributes. see android.text.Html (on GrepCode) and How to apply font size while rendering HTML code in Android or Java and TextView with different textSize for more. Hope it helps in someway.

    0 讨论(0)
提交回复
热议问题