foreverstudent

android 设置背景为空(透明)

在给控件设置背景时像ps那样的背景透明

在3.0以下可以使用

imageView.setBackgroundResource(android.R.id.empty);

但是这个方法在3.0以上会出现

ERROR/AndroidRuntime(xxxxx): Caused by: android.content.res.Resources$NotFoundException: File  from drawable resource ID #0x1020004
可以用
imageview.setBackgroundColor(Color.parseColor("#00000000"));

imageview.setBackgroundColor(android.R.color.transparent);

分类:

技术点:

相关文章: