Html 字体大小在 android 应用程序中不起作用 [英] Html font size not working in android application

查看:58
本文介绍了Html 字体大小在 android 应用程序中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 android 新手,我正在开发小型 android 应用程序.在我的应用程序中,有一个按钮,其中包含多行文本和不同样式的文本.我是通过以下方式做到的:

I am new to android, and I am developing small android application.In my application one button is there which contains text with multiple lines and with different style of text. I did it in following ways :

<Button
           android:id="@+id/downloadButton"
       android:layout_width="200px"
       android:layout_height="65px"  
           android:background="@drawable/download_button"
       android:textColor="@android:color/white"
       android:layout_alignParentLeft="true"
      />

为了显示文本,我做了以下事情:

And for displaying text I did following thing:

Button download_button = (Button) findViewById(R.id.downloadButton);
    String download_styledText = "<font size='10'color='white'>"
            + "Download" + "</font> " + "<br />"+""+"<font size='7'color='#883e33'>" 
            + "Save it now!"+"</font>";
    download_button.setText(Html.fromHtml(download_styledText));

一切正常,唯一的问题是我的字体大小属性不起作用...如果我定义了大或小标签,其工作正常,但对于字体大小,它没有提供正确的输出...该怎么办?需要帮助...谢谢...

everything is working fine the only thing is that My font size property is not working... If I define tags like big or small its working fine but for font size its not giving proper output ... What to do ? Need help ... Thank you ...

推荐答案

如这里回答:如何在 Android 或 Java 中渲染 HTML 代码时应用字体大小

android 中实现的字体标签不支持大小.也不以任何方式支持 CSS.

the font tag as implemented in android does not support size. CSS is not supported in any way either.

这篇关于Html 字体大小在 android 应用程序中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆