【问题标题】:Xamarin.Android how to override style from nuget library?Xamarin.Android 如何覆盖 nuget 库中的样式?
【发布时间】:2017-11-21 14:09:03
【问题描述】:

我在我的 Xamarin.Android 项目中使用例如 BottomNavigationBarXF 库,我想更改它使用的字体。我发现源代码样式对此负责,但我不知道如何在不向我的项目中添加库源代码的情况下覆盖它们。

样式在这里:source code.

有可能吗?我想更改这个字体:BB_BottomBarItem_Fixed.TitleAppearance

【问题讨论】:

    标签: android xamarin xamarin.android android-styles


    【解决方案1】:

    有可能吗?我想改变这个字体:BB_BottomBarItem_Fixed.TitleAppearance

    根据README of BottomNavigationBar。您可以使用BottomBar.SetTextAppearance(resId) 设置底部Navigationbar 的文本外观。

    所以第一步,在styles.xml中定义文本外观样式:

     <style name="MyTextAppearance">
        <item name="android:textSize">12sp</item>
     </style>
    

    然后在创建底部栏后使用此样式:

    var _bottomBar = BottomBar.Attach(this, savedInstanceState);
    ...
    _bottomBar.setTextAppearance(Resource.Style.MyTextAppearance)
    

    【讨论】:

      猜你喜欢
      • 2015-06-22
      • 1970-01-01
      • 2011-09-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-21
      • 1970-01-01
      • 2019-08-05
      相关资源
      最近更新 更多