【问题标题】:Set default font size in styles.xml在styles.xml 中设置默认字体大小
【发布时间】:2018-03-18 20:26:22
【问题描述】:

我正在做一个安卓项目。

我有一个标签页,页面的标题很大。 我想做的是通过更改styles.xml中的值来减小字体大小

你知道有没有可能?

该项目是用 Xamarin 编写的,所以我想避免编写一些特定的代码,比如渲染器。

非常感谢

【问题讨论】:

    标签: android xamarin


    【解决方案1】:

    这是可能的 styles.xml如下:

     <style name="FontTheme" parent="Theme.AppCompat.Light.NoActionBar">
            <item name="android:textSize">20sp</item>
            <item name="android:textColor">@color/black</item>
     </style>
    

    使用代码:

    <TextView   
        style="@style/FontTheme"  
        android:layout_marginTop="100dp"  
        android:text="test1"/>
    

    【讨论】:

    • 我正在开发 Xamarin,我无法在控件上设置样式。在 styles.xml 中是否有办法为每种 UI 组件定义默认字体大小?谢谢
    猜你喜欢
    • 1970-01-01
    • 2017-12-10
    • 2013-07-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多