No, electric do not cars charge while driving. EVs are designed to charge from an AC source and it isn’t possible to charge them direct from solar panels, for example.
It sounds a great idea to have a car covered in solar panels so it can drive forever, but it doesn’t work like that at the moment.