java - 按钮在预览时透明,但在模拟器上稳定
问题描述
我正在尝试将一些按钮设置为透明,部分透明。他们使用透明/纯色渐变。
它们在预览中显示得很好,但在模拟器和我的手机上它失去了所有透明度。
这是我的 XML 代码:
<Button
android:id="@+id/barbarian"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/button_gradient"
android:text="@string/barbarian" />
如果需要,可以使用 xml 渐变代码:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="@android:color/transparent"
android:endColor="#FF000000"
android:angle="0" />
</shape>
我感谢任何和所有的帮助!
解决方案
推荐阅读
- c++ - 缓冲区填充了不同类型的数据,以及严格的别名
- swift - IUO 作为 Swift 4.2 中的字典键
- java - hadoop中如何创建datanode路径?
- c# - 如何使用 jQuery 不显眼的验证从表单字段中删除“必需”设置
- python - 如何正确地将类型提示添加到 Mixin 类?
- ios - 将 ImageView 放在 iOS 中的另一个图像上
- java - mongo spring如何根据嵌套数组中的值对结果进行排序
- javascript - 在写入文件然后断言 Cypress.io 测试时,系统会抛出“expected undefined to equal..”
- php - SQL 数据库的更新时间
- android - Android App Bundle 新语言