My experience is that if you obviously look like a foreigner by mannerism - even if you're an ethnic Chinese - the locals don't care if you're wearing shorts. They judge you and interact with you differently anyway.
It's surprisingly easy to detect whether someone isn't a local. The Chinese are very fine tuned at it.