Sounds like they want something from you, but prefer that there friends don't know that. Don't tolerate this treatment! Get your self respect together, and don't give them the time of day unless they change the way they treat you. No attention at all, is better than that kind. You're worth more than that, so hold your head up and move forward. You'll find yourself attracting a different, and better, type.
He is only nice to you when your alone cos he won't get to use you in private if he's mean. In public he has nothing to loose. Ditch the wan?er!! You will be much happier & your self esteem will not take a downward spiral.