Gray, who was reportedly the subject of bids from Bournemouth and Tottenham during the summer, is set to start in Tuesday's Carabao Cup game against Liverpool.
The England U21 winger has scored three goals for Leicester since joining from Birmingham in 2016 and his end product has come under criticism.
Portugal forward Ronaldo was just 18 when he joined Manchester United in 2003 and he took time to adjust to life at Old Trafford.
"People used to criticise Ronaldo for the same things," said Shakespeare.
"With run of games and experience, that will come.
"If the opposition put two defenders against you and you're trying to beat them all the time, then you have to find another solution. That's what football is all about, finding the right solution for that given moment.
Speaking about the 21-year-old's new deal, Shakespeare added: "The contract is in the final instalments, his advisers are talking with our director of football and I'm expecting that to be completed sooner rather than later."
Shakespeare said that Leicester intend to keep all of their players, adding: "It's well documented we had bids for Demarai. We didn't want to sell him, we want to build the club with players of his ilk.
"He's shown a real desire now to want to stay and progress his career with this club. It's important we now tie that one up and concentrate purely on his football."