Hello,
Purple colored 
bruise under the knee is indicative of torn 
hamstring muscle. However it can also be due to baker's 
cyst or 
deep vein thrombosis. With both conditions you may have pain, swelling, and bruising behind the knee and calf. You are suggested to get clinically examined by a GP. Get Imaging tests done along with blood tests to detect the pathology causing you discomfort. You will be treated accordingly.
You can apply Ointment Thrombophob on the area affected by the bruise, it will help to reduce the 
blood clots under the skin and inflammation. The torn hamstring often heals by itself. In the meantime, you should take a break from strenuous exercises to allow the 
injury to heal. Avoid putting weight on your affected leg. Ice compression is effective. Wrap the injured area with a compression bandage or wear compression shorts to minimize swelling (it should not be tight).
You can take NSAIDS, one stat when needed to ease pain and discomfort. You are suggested to let your leg relax. You can start gentle stretch exercised under a Physical therapist after the pain subsides as aggressive stretching and exercises will delay healing. Get clinically examined by a GP. In case it is bakers cyst you may need surgical excision. Get treated for any other pathology detected, get required investigations done. You will be accordingly treated.
Take care. Hope I have answered your question. Let me know if I can assist you further.
Regards,
Dr. Nupur K., General & Family Physician