He probably doesn't dislike sunlight, it's just not the right
set up.
If you want your dragon to benefit from sunlight, put him in a well ventilated cage and make sure that there is a good amount of shade on one side, and put him outside when it's warm. We built a cage just for that and he loves it.
It is true however that when a dragon is put in sunlight he gets a little nuts. My dragon becomes way more aggressive when I try to take him out of the sun, so much so that he bites me, whereas he has never bitten me indoors.
From what I've heard, you should never put your actual cage indoors in the sun. THere's no breeze or proper ventilation that way. He could be too hot and that's why he's hiding. 
Anyway, good luck 