Except, this story is a hodgepodge of elements that have been tacked on over the years. Many major tellings of the legend, have added new elements, that became canon elements of the story. Originally, the story didn't take place during the rein of Richard the Lionheart, or specifically any time period. Oral traditions of Robin Hood don't specifically mention any king. The earliest known ballads were actually created centuries later.
Robin Hood was not originally a Nobleman, nor was he named "of Locksley". He was a Yeoman, an autonomous working class, just above the Peasant class, which explains his proficiency with the bow, which was the realm of Yeoman, whereas Noblemen were raised to be proficient with the sword, but not typically the bow. Later, upper-class tellings are probably responsible for elevating Robin to the Noble class.
Robin Hood did not originally give to the poor. He was a thief who robbed from the rich. This made him a hero to the lower classes as a way of saying "down with the man". The "giving to the poor" aspect was tacked on later, as a way of morally justifying the heroism of a thief.
Original tellings didn't have a Prince John, or really mention any particular ruler. Robin Hood's main antagonist was the Sheriff. The Sheriff did, however, have a sidekick; his cousin, Guy of Gisbourne. In this aspect, the 1990's Kevin Costner Robin Hood, "Prince of Thieves", was more like the old legends, in that it left out the Prince John character, making the Sheriff of Nottingham and Guy of Gisbourne the primary antagonists. Also, early ballads had Robin Hood decapitating both, which is much grislier than the Robin Hood we expect, today. Other antagonists were corrupt priests and bishops.
Robin, Little John, and the Merry Men go back to the earliest ballads. But May Day celebrations of the 15th century plays introduce characters Friar Tuck, Maid Marian, and reposition Will Scarlett as Robin's brother.
In the 18th century, historians began to postulate that Robin Hood was based on a historical figure. Robert Ritson examined different versions of the legend, and placed him in the 1200s, during the time of Richard the Lionheart. He published a collection, outlining the complete story of Robin Hood, containing most of the elements known today.
In the 20th century, many movie and TV adaptations familiarized the well-known narrative in the minds of the general public.