My knee cap is floating since I sprained my knee. Most of the swelling is gone, but some remains?

Can last a long time. Pain and swelling may last a long time following any injury. Have it evaluated by you orthopedist and get the appropriate treatment to avoid future complications.
Can last awhile. Ice elevation and rest and see an orthopedic surgeon to make sure there is not another cause and that there isproper healing to avoid complications.
See ORS. Not sure the severity of your knee sprain w/o more history or a physical exam. If u had signifigant swelling and it is now reduced and u feel like your kneecap is "floating" it sounds like u still have an effusion ( (joint fluid) and may have sustained a serious knee injury. (acl, meniscus tear, patellar dislocation w/ loose body, etc.)see a board certified orthopedic surgeon. Good luck!