微调框弹出背景颜色问题 [英] Spinner popup background color issue

查看:53
本文介绍了微调框弹出背景颜色问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码在华硕Intel Zenfone上产生问题(请参阅附图).我测试过的所有其他设备都显示正常,这表示Spinner弹出窗口周围的黑色区域是透明的.

The following code produces an issue (see attached images) on Asus Intel Zenfone. Every other device I tested on is showing it fine, meaning the black area around the Spinner popup is transparent.

有什么方法可以消除黑色?我已将Theme.AppCompat.Light.NoActionBar应用于Activity.

Any way to get rid of black color? I have Theme.AppCompat.Light.NoActionBar applied to the Activity.

<android.support.v7.widget.AppCompatSpinner
    android:id="@+id/spinner"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="16dp"
    android:layout_marginRight="16dp"
    android:popupBackground="@color/light_primary" />

推荐答案

我遇到了同样的问题,最终我得到了解决方案.您需要在drawable文件夹中创建一个xml文件.

I face the same problem,finally i got solution.You need to create one xml file in drawable folder.

<?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="#606d73" />
</shape>

,然后将其应用于微调器:

and then apply it to the spinner:

<Spinner
 android:id="@+id/from_spinner"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:background="@drawable/refine_drpdn_right"
 android:drawSelectorOnTop="true"
 android:popupBackground="@drawable/spinner_popup_background"
 android:spinnerMode="dropdown" />

这篇关于微调框弹出背景颜色问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆