gpt4 book ai didi

android:elevation 应用于工具栏及其标题

转载 作者:太空宇宙 更新时间:2023-11-03 13:44:53 27 4
gpt4 key购买 nike

我使用一种非常简单的样式来格式化我的工具栏,我使用 android:elevation 在工具栏下显示阴影,如下所示:

<style
name="AppToolbarTheme"
parent="AppTheme">

<item name="android:background">@color/colorPrimary</item>
<item name="android:titleTextColor">@android:color/white</item>
<item name="android:elevation">4dip</item>
</style>

我只是像那样应用它:

<Toolbar
android:id="@+id/main_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppToolbarTheme"/>

阴影像我想要的那样显示在工具栏下方,但是它也以某种方式应用于看起来很奇怪的工具栏标题:

enter image description here

最佳答案

删除 <item name="android:elevation">4dip</item>从样式并将其放入toolbar XML

<Toolbar
android:id="@+id/main_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppToolbarTheme"
android:elevation="4dp"/>

关于android:elevation 应用于工具栏及其标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44346959/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com