popupBackground glitches with Material Design

◇◆丶佛笑我妖孽 提交于 2020-01-03 06:44:13

问题


I have been working on updating my apps to Material Design.

I have an app that uses tabs. For some reason whenever I use android:popupBackground to set the drop down menu color it freaks out.

I set up a default project with tabs and used the following theme and the same thing happened. Has anyone one else had this problem? My app is open source and so all the code is available here GitHub

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="actionDropDownStyle">@style/Dropdown</item>
    </style>
    <style name="Dropdown" parent="Widget.AppCompat.Light.Spinner.DropDown.ActionBar">
        <item name="android:popupBackground">#000</item>
        <item name="android:paddingLeft">32dp</item>
        <item name="android:paddingRight">32dp</item>
    </style>
</resources>

回答1:


I had faced a similar issue with spinner. As @alanv mentioned use shape as background instead of colour will solve the problem.

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="#000000" />
</shape>

UPDATE It is resolved in latest AppCompat.



来源:https://stackoverflow.com/questions/26770848/popupbackground-glitches-with-material-design

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!