【问题标题】:How can I change a TextView's font programmatically in a RemoteView?如何在 RemoteView 中以编程方式更改 TextView 的字体?
【发布时间】:2013-07-09 10:44:39
【问题描述】:

有没有办法以编程方式更改小部件中文本视图的字体系列?我只想使用系统字体(Roboto Thin、Condensed 等),而不是任何自定义字体。

【问题讨论】:

    标签: android android-layout android-widget


    【解决方案1】:

    是的,你可以使用 RoboFont 的库,下面是我如何将库用于 textview 的示例。

    <com.eevoskos.robotoviews.widget.RobotoTextView
                    android:layout_weight="1"
                    android:background="@color/table_row_header"
                    android:gravity="center"
                    android:padding="@dimen/table_row_header"
                    android:text="Product"
                    app:typeface="condensed_bold" />
    

    【讨论】:

    • 对不起,我应该更具体。我的意思是如何以编程方式更改字体。我希望用户能够选择他们喜欢的字体,然后根据他们的选择选择字体。不过感谢您的回答!
    • 如何给出选项我不知道,但如果你想为用户使用自定义字体。你也可以对编辑文本做同样的事情。
    猜你喜欢
    • 2017-12-02
    • 1970-01-01
    • 2015-01-09
    • 2016-07-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-28
    • 2012-12-19
    相关资源
    最近更新 更多