Why do guys fix their hair around girls?

is it because they like her?

for ex. I was hanging with this dude and he told me he saw me looking up at his hair so he asked if it looked good and I said yeah becuase I wasn't even thinking about his hair and then he looked in the mirror to fix it