MaterialComponents操作栏文本不能小写吗? (textAllCaps不起作用)

问题描述 投票:0回答:1

我正在使用此主题Theme.MaterialComponents

我的问题是我添加了一些菜单,该菜单是简单的可单击文本,并且在操作栏上显示为大写(请参见下图):

“问题”

我的资源文件包含以下文本:

<string name="register_user_action_v2">Создать</string>

我尝试在主题中添加actionMenuTextAppearance样式:

<style name="Theme.MyDarkMaterialDesignBar" parent="Theme.MaterialComponents">

...

<item name="android:actionMenuTextAppearance">@style/MyMenuTextAppearance</item>
<item name="actionMenuTextAppearance">@style/MyMenuTextAppearance</item>

...

</style>

其中MyMenuTextAppearance

<style name="MyMenuTextAppearance" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Menu">
        <item name="android:textAllCaps">false</item>
        <item name="textAllCaps">false</item>
</style>

但是仍然无法正常工作。

如何使此文本看起来像普通文本(例如Создать,而不是СОЗДАТЬ)]

P.S。也许我的@style/TextAppearance.AppCompat.Widget.ActionBar.Menu有问题,我应该为MaterialComponent主题使用其他内容吗?

谢谢!

android android-actionbar material-design themes
1个回答
0
投票

您可以使用:

 <com.google.android.material.appbar.MaterialToolbar
            android:id="@+id/toolbar"
            ../>

toolbar = findViewById(R.id.toolbar); //Material toolbar
setSupportActionBar(toolbar);

具有这种样式:

  <style name="AppTheme" parent="Theme.MaterialComponents.*">
    <item name="actionMenuTextAppearance">@style/actionbar_menu</item>
  </style>

  <style name="actionbar_menu" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Menu">
    <item name="textAllCaps">false</item>
  </style>

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.