1

I have a customer adapter which is used to displays a list of items. I want to show a light white colored tint over the whole custom adapter whenever the user long clicks an item to give a sense of selection (I also plan to place an image over it later on, like a heart or thumbs icon to represent that the item has been liked but that's a different story).

But the problem is how to do it, I can't figure it out and also couldn't find anything on Google.

What would be a simple way for doing it?

1 Answers1

2

Why you aren't trying to change the value of alpha of your adapterview? Just like-

public View getView(final int position, View convertView, ViewGroup parent) 
{ .
  .
  .

  convertView.setAlpha(0.4);   //change the value as per your need
}

Even if you don't want to use this feel free to make a state_selected item in your selector and use on your adapter onItemLongClick.

As per op's need posting this tutorial link, it describes the way to implement an Instagram-like Heart Animation: http://ratiksharma.com/blog/implementing-an-instagram-like-heart-animation-on-android/

ridoy
  • 6,274
  • 2
  • 29
  • 60
  • Thank you for the answer :) I suppose `setAlpha()` only works as indented when the background is white otherwise the item shows a colored tint and I don't know how to set `state_selected` using java. Also I think I have not explained what am I exactly going for, if you must have seen the Instagram app, whenever you like a photo a heart icon appears on top of it for a short while, I'm trying to do just that but also with faded-white-ish background over the whole adapter. – Abhishek Aggarwal Dec 03 '16 at 21:34
  • 1
    I believe you are looking something like this one: http://ratiksharma.com/blog/implementing-an-instagram-like-heart-animation-on-android/ – ridoy Dec 04 '16 at 07:21
  • 1
    That tutorial looks great. Thanks ton :) Would you post that comment as an Answer so I could mark it as accepted? – Abhishek Aggarwal Dec 04 '16 at 12:01
  • 1
    Thank you for informing me about that, posted the link in the main answer. :) – ridoy Dec 05 '16 at 16:42