android.R.color.transparent 不完全透明 [英] android.R.color.transparent not fully transparent
问题描述
在我的应用程序中,我在运行时将透明背景应用于我的 ListView
的 CustomListItem.为此,我使用 convertView.setBackgroundColor(android.R.color.transparent);
.它有效并显示透明度.但这并不完全透明,因为背景有某种阴影.我还尝试将我自己的透明颜色与值 #80000000
和 #00000000
一起放置,但结果更糟.我该怎么做才能获得完全透明的颜色?
In my application, I apply the transparent background to my ListView
's CustomListItem at runtime. For that I use, convertView.setBackgroundColor(android.R.color.transparent);
. It works and shows transparency. But that is not fully transparent as there is some kind of shade to the background. I also tried putting my own transparent color with the values #80000000
and #00000000
but the result is worse. What can I do to get the fully transparent color?
推荐答案
android.R.color.transparent
是一个资源id(指透明颜色定义) - View.setBackgroundColor(int)
需要一个实际的 int 颜色.
android.R.color.transparent
is a resource id (referring to a transparent color definition) - View.setBackgroundColor(int)
expects an actual int color.
使用 View.setBackgroundResource(int) 相反,它将从资源加载实际颜色.
Use View.setBackgroundResource(int) instead, which will load the actual color from resources.
这篇关于android.R.color.transparent 不完全透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!