【发布时间】:2019-01-28 15:41:55
【问题描述】:
我是 Android Studio 的初学者,我需要您的帮助才能在我的布局上应用特定的透明度。
我使用这个可绘制对象为我的布局应用了背景和边框颜色:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/black" />
<corners android:radius="3dp" />
<stroke android:width="5px" android:color="#ffa500" />
</shape>
现在我想动态地为这个按钮应用透明度(通过使用搜索栏),但只在背景颜色上我不想修改我的边框颜色。 我尝试使用 setAlpha 函数,但它也改变了我的边框颜色透明度。
我该怎么做? 谢谢。
【问题讨论】: