HANOI, Vietnam — Goose-stepping soldiers and children with red Communist kerchiefs greeted Kim Jong-un on Friday afternoon in Vietnam, as the North Korean leader shifted from the unpredictability of his summit meeting in Hanoi with President Trump, which ended unexpectedly with no accord, to a carefully staged state visit.

A day after the meeting ended abruptly and ahead of schedule, President Nguyen Phu Trong of Vietnam welcomed Mr. Kim to a more familiar atmosphere, with solemn expressions of Communist comradeship, martial music and soldiers parading with rifles as the two leaders watched from a reviewing platform.

The meeting with Mr. Trump was supposed to make progress toward eliminating North Korea’s nuclear weapons program and formally ending the Korean War. But there was another, implicit agenda, as well: Both allies and adversaries of Mr. Kim’s impoverished and oppressed nation had hoped that he might be inspired by the way Vietnam has flowered economically while keeping a grip on politics.

It was not clear how much of that message he might absorb. After meeting with the impulsive Mr. Trump and facing an unruly throng of journalists, Mr. Kim turned to a schedule with all the scripted, red carpet formality of an official visit to a fellow Communist state.