gpt4 book ai didi

android - 通过xml设置drawable的alpha

转载 作者:太空宇宙 更新时间:2023-11-03 10:29:47 26 4
gpt4 key购买 nike

我们可以通过XML为它的禁用状态设置drawable的alpha吗?例如通过使用 android:state_disable。

最佳答案

这是我的解决方案,希望有人觉得这有用。是的,这是旧帖子,但像这样的帖子需要一个今天有效的答案,因为它们会在您搜索时显示。

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false">
<bitmap android:alpha="@integer/disabled_alpha" android:src="@drawable/item"/>
<item/>
<item android:state_enabled="true" android:drawable="@drawable/item" />
</selector>

关于android - 通过xml设置drawable的alpha,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7793013/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com