android.R.color.transparent not fully transparent

前端 未结 5 1235
忘掉有多难
忘掉有多难 2020-12-17 20:40

In my application, I apply the transparent background to my ListView\'s CustomListItem at runtime. For that I use, convertView.setBackgroundColor(android.

相关标签:
5条回答
  • 2020-12-17 21:04

    Use this from now in your xml's files when you want transparency in your views:

    android:background="@null"
    

    You are going to get a better performance.

    0 讨论(0)
  • 2020-12-17 21:05

    Try:

    convertView.setBackgroundColor(Color.argb(0, 0, 0, 0));
    
    0 讨论(0)
  • 2020-12-17 21:11

    android.R.color.transparent is a resource id (referring to a transparent color definition) - View.setBackgroundColor(int) expects an actual int color.

    Use View.setBackgroundResource(int) instead, which will load the actual color from resources.

    0 讨论(0)
  • 2020-12-17 21:18

    Set this attribute to your listview in xml file

    android:background="@android:color/transparent"
    

    and also apply the transparent background to your ListView's CustomListItem at runtime. For that you have use,

    convertView.setBackgroundColor(Color.TRANSPARENT);
    

    Thanks

    0 讨论(0)
  • 2020-12-17 21:25
    convertView.setBackgroundColor(Color.argb(0, 0, 0, 0));
    

    OR

    convertView.setBackgroundColor(Color.parseColor("#00000000"));
    
    0 讨论(0)
提交回复
热议问题