我想自定义弹出菜单,背景颜色为浅黑色,文本颜色为白色。我正在使用“主题.材料组件.灯光.睡眠吧”作为父项。我试图自定义,但有一些白色的空间,从上到下在弹出式菜单。x1c 0d1x我想改变整个弹出菜单的背景。请帮
我添加->
<item name="android:itemBackground">@color/colorLightBlack</item>
<item name="android:itemTextAppearance">@style/MyActionBar.MenuTextStyle</item>
This is My Themes.xml file ->
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.KawawaMusic" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/black</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/black</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">@color/transparent</item>
<!-- Customize your theme here. -->
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowContentTransitions">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
<item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
<item name="android:windowSharedElementExitTransition">@android:transition/move</item>
<item name="windowNoTitle">true</item>
<item name="bottomNavigationStyle">@style/Widget.App.BottomNavigationView</item>
<item name="android:itemBackground">@color/colorLightBlack</item>
<item name="android:itemTextAppearance">@style/MyActionBar.MenuTextStyle</item>
</style>
<style name="bottom_nav_style">
<item name="colorPrimary">@color/white</item>
</style>
<style name="Widget.App.BottomNavigationView" parent="Widget.MaterialComponents.BottomNavigationView.Colored">
<item name="materialThemeOverlay">@style/ThemeOverlay.App.BottomNavigationView</item>
</style>
<style name="ThemeOverlay.App.BottomNavigationView" parent="">
<item name="colorPrimary">@color/white</item>
<item name="colorOnPrimary">@color/white</item>
</style>
<style name="MyActionBar.MenuTextStyle"
parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/white</item>
<!-- <item name="android:textStyle">bold</item>-->
<item name="android:textSize">14sp</item>
</style>
</resources>
1条答案
按热度按时间axkjgtzd1#
将下面一行添加到您的基础应用主题中:
然后创建一个单独的样式,如下所示: