【问题标题】:Android options menu. White strip top and bottom of menu安卓选项菜单。菜单顶部和底部的白条
【发布时间】:2021-08-25 01:48:18
【问题描述】:

我是 Android 开发的菜鸟。

如何删除或更改选项菜单顶部和底部条的颜色? 我已将<item name="android:itemBackground">@color/AraLightBlue</item> 输入到“themes.xml”文件中。 效果很好。

我创建了这个样式(square_menu.xml)

<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <corners android:radius="0dp"/>
    <padding
        android:top="0dp"
        android:bottom="0dp"
        />
</shape>

并添加

<style name="ThemeOverlay.MyTheme" parent="ThemeOverlay.AppCompat.Light">
    <item name="android:itemBackground">@color/AraLightBlue</item>
    <item name="android:popupBackground">@drawable/square_menu</item>
</style>

到主题.xml 并添加 app:popupTheme="@style/ThemeOverlay.MyTheme" 到activity_main.xml。

我错过了什么?

【问题讨论】:

    标签: android xml customization


    【解决方案1】:

    使用 solid 参数

    试试这个:

    <shape xmlns:android="http://schemas.android.com/apk/res/android">
        <solid android:color="your color"/>
        <corners android:radius="0dp"/>
        <padding
            android:top="0dp"
            android:bottom="0dp"
            />
    </shape>
    
    
    

    【讨论】:

    • 没有变化。白色条纹仍然存在。
    • @tridiak 你有没有解决这个问题,因为我面临同样的问题
    猜你喜欢
    • 2019-01-25
    • 1970-01-01
    • 1970-01-01
    • 2011-06-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多