Gunfire that came from an unidentified vehicle hit the child, who was in an apartment complex on Country Club Boulevard and Grange Avenue at the time.
The child is in critical condition and undergoing surgery, according to the San Joaquin County Sheriff's Office.
The sheriff's office does not believe the 7-year-old was the intended target of the shooting.
Information regarding the suspect or suspects in the drive-by shooting has not been reported by local officials.
Stay with FOX40 News for more updates on this developing story.