“All these people moving in here now, they don’t know what I know,” Shaw resident Williams says, meaning the newcomers, most of them affluent young professionals. “There’s a lot they don’t know about. So I always try to help.” (Michael Robinson Chavez/The Washington Post)

Because of his age-old street smarts, and because he is retired, meaning he can idle on the sidewalk for as long as he wants, smoking Newports and watching the world pass by, Richard Williams, 66, is the unofficial mayor and sheriff of his block on Seventh Street in the District’s gentrified Shaw neighborhood.

Most days, you’ll find him in front of Hodge on 7th, the apartment building where he lives, between O and P streets NW. If you seem lost, he’ll ask where you’re headed and politely offer directions. If you pluck a flower out of a planter at the building’s entrance, he’ll scowl and set you straight, demanding, “How dare you?”

Lately, a barely coherent homeless man in a rickety wheelchair has taken up residence in a bus shelter on the block, and Williams has been trying to have him relocated. Nearby, a gaggle of worn-out, middle-aged loiterers, including a few ex-inmates, congregate on a street corner, cadging dollars. Williams keeps a wary eye on them.

“All these people moving in here now, they don’t know what I know,” Williams says, meaning the hordes of newcomers, most of them affluent young professionals, who have made Shaw an epicenter of gentrification in Washington.

“There’s a lot they don’t know about,” he says. “So I always try to help.”

The once-downtrodden neighborhood, infested with violent drug dealers years ago, is today filled with new, high-rise luxury residential buildings. And the centerpiece of the redevelopment is City Market at O, a 407-unit complex that is loaded with amenities, where two-bedroom apartments are priced at up to $4,000 a month.

In many parts of the city since the mid-2000s, especially in and near downtown, an influx of young, college-educated and well-paid workers, mainly white, has spurred an economic boom and drastically altered the District’s racial makeup. But it also has caused financial and social upheaval for many people rooted in Washington for generations.

Mindful of the problems associated with gentrification — that property values and tax bills go way up, forcing many longtime homeowners and renters to move — the City Market developers also built Hodge on 7th, a complex of 90 one-bedroom apartments with moderate rents for childless tenants 55 and older.

Richard Lake, a partner in Roadside Development, which built the complexes a few years ago, says his company hopes to figure out ways to socially integrate the affluent tenants in the market-rate high-rise with their neighbors in the decidedly less swanky building. But so far, their lives are mostly separate, which has led to some underlying resentment.

“One amenity we have is coffee,” says Shaw native Khaleedah Harris, 67, a retired government worker. Sitting in the Hodge community room, she gestured to a coffee maker and a caddie filled with coffee packets and sweeteners. “Versus the other building, where they have danish, and daily this and daily that, cookies, juice. We get coffee from 9 to 12 in the morning, and if you miss that, well, you don’t get any.”

The tenants at City Market also have a pool and a dog park, among other luxuries.

“We can’t use anything over there unless we’re invited,” says Williams, a retired tour bus driver who was raised in the Petworth neighborhood and lives at Hodge. “As far as us walking into that building, we’re trespassing.”

But he concedes, “We’re paying a lot less than they are.”

The developer receives tax benefits for providing affordable housing. The Hodge apartments, each with a maximum of two occupants, are all one-bedrooms. The monthly rent is $964 for one person making no more than $37,450 a year or a couple making no more than $42,800. For a single tenant making no more than $44,940 or a couple making no more than $51,360, the rent is $1,169 a month.

For all the differences in their lifestyles, Hodge tenants say, they are unfailingly treated with kindness and respect by their more well-to-do neighbors.

In return, amid the youthful swirl in this newly upscale Shaw, the more mature, sedate folks of Hodge on 7th are quick to dispense their hard-earned wisdom to the newcomers.

“For instance, the women around here,” Williams says, standing in front of the building one morning. “If you’re out here at night, fumbling around in your pocketbook for your keys, I don’t care who you are. If I’m outside, you’re going to hear from me, okay? Because you’re inviting a robbery. I’ll tell them, if you’re going to fumble around in your pocketbook, go inside the vestibule and do it.”

He sighs ruefully. “Best thing, I’ll tell them, if you’re getting off the bus, make sure you already have your keys out when you get off the bus.”

Wanda Cave, a part-time nurse in her 60s who was born in the LeDroit Park neighborhood, says she has “no problem reprimanding young adults.”

“They don’t give me any back talk. I mean, they say things you don’t want to hear, that isn’t pleasant to the ears. I’ll tell them: ‘I don’t want to hear that language! Keep that to yourself!’ And you know what? They apologize! They’ll say, ‘Oh, I’m very, very sorry, ma’am.’ ”

In the mid-20th century, Shaw was largely a thriving community of middle-class African Americans. But riots following the 1968 assassination of the Rev. Martin Luther King Jr. left the neighborhood a wasteland. And in the 1980s and ’90s, it was a nightly battlefront in the crack wars, with rival drug dealers trading lethal gunfire.

Even amid the area’s remarkable revival, vestiges of that sorry history remain. Young gangbangers still occupy recesses of the neighborhood, although their ranks are thinner now. Down-and-outters still loiter, and hustlers still ply the street corners.

Williams says this dicey aspect of Shaw isn’t readily visible to the newcomers as they push their pricey baby strollers, pedal their high-end bicycles and stroll along with their heads down, talking and tapping on their cellphones.

But the older folks see it.

“There’s this guy out here all the time, I saw him the other day, running his scam on this young couple,” Williams says. “He pretends he’s so sick, he’ll walk out in traffic, stop all the cars, ask for help. And this couple walks him back to the sidewalk over here. And then he puts on his act. He fell against the pole and slid down to the ground. And then he’ll say he’s okay now, but can he have a little money. That’s his scam.”

After the couple helped him, Williams says, they called an ambulance.

“When they left, I went over to the paramedics, and I said, ‘You know he’s running a game on y’all, right?’ And they just said, ‘Yeah, yeah, we know, we know.’ ”

As he relates this story, Williams is walking along Seventh Street toward the bus shelter where the homeless man in a wheelchair spends his days. He gives his name as Frank Calvin Edwards. He is obese and diabetic. He wears an old sneaker on his right foot, and his left foot is bare. The left foot is a gray blob, swollen to about three times normal size. Williams has called ambulances on several occasions. But Edwards refuses help.

One day not long ago, Williams was surprised to find Edwards upstairs in a Hodge hallway, in his wheelchair. How he got in is a mystery.

Edwards says: “I went in the building because one of my boys told me to come up there. And I went up there. And I fell asleep in the hallway waiting for him. He went to bum a cigarette. And you see how my foot is.” That’s his full explanation.

Williams got him out of the building. “You see, the younger people around this neighborhood, they don’t know what to do,” he says. “They come from places where they don’t see things like this, a lot of them.”

All the same, he enjoys the gentrifiers.

“I would say it’s their attitude, their passion,” he says. “Because if you get in a conversation with them, it’s different from having conversations with the young people that used to be around here years ago. They’re more in tune what’s going on, especially politically. They say what’s on their minds. They have no regrets.”

Says Wanda Cave: “I’ve lived long enough to know that nothing stays the same and you can’t get jaded. Whatever you did when you were young, and older people didn’t like it, they’re doing it now. And so I listen and I accept it.”

Williams agrees, smiling broadly.

“My wife and I, we swear: The only way we’re leaving this place is in body bags.”