Android: Transparent Colored ListViews with Background

后端 未结 3 1339
无人及你
无人及你 2021-01-14 18:05

I have a doubt I have a listview and below it there is a background with a image. I would like to have the lists with a transparent color in order to see the image in the b

3条回答
  •  别那么骄傲
    2021-01-14 18:35

    I managed to achieve this with the RecyclerView by adding this line of code to the 'onBindViewHolder' method in the 'RecyclerView.Adapter' class:

    ((RelativeLayout) holder.itemView).getChildAt(0).setBackgroundColor(Color.parseColor("#00FFFFFF"));
    

    Bear in mind that the view returned by the above cast expression is an 'android.support.v7.widget.CardView' that contains the list item layout

提交回复
热议问题