How to apply font size while rendering HTML code in Android or Java

后端 未结 2 1474
抹茶落季
抹茶落季 2020-12-16 15:09

My code is as follows.

textView.setText(Html.fromHtml(\"64\"));

The output is:

2条回答
  •  不思量自难忘°
    2020-12-16 15:34

    I found the solution of how to set different size in a single TextView.

    At first define a TextView and connect it to xml and follow this.

    
    

    Then go to Java page

      TextView  txt=(TextView)findViewById(R.id.txt);
    
    txt.setText(Html.fromHtml("Xyzd.com"));
    

    However, the big tag automatically increases 2-4 sp size and the small tag reduces 2-4 sp.

    Increase and decrease your text size from xml android:textSize="15sp".

    It works just check it.

提交回复
热议问题