I lined our cabinets with foam drawer liner material as shown. It stays in place with cut squares of carpet tape in the corners. The foam liners resist slippage. The liners also reduce the rattling noise of items inside cabinets.

I even lined each utensil compartment. It all helps, primarily with the noise, but also the movement.

As AMW mentioned, many items need to be placed in small tote containers. My wife found small 9" containers with solid bottom & vertical walls that resemble this, found at a local Dollar Store which make great totes. Spills are contained, they wipe out easy. The shape and vertical walls utilize space nicely.
In general it's good to keep your cabinets full or the open space blocked with tote containers. Open space should favor the rear inside each cabinet so when you brake hard, the stuff is already forward. You'll never accelerate fast enough to throw the stuff rearward.
Heavy duty stabilizer bars and good shock absorbers also help keep everything in place. A more stable (less earthquake) ride is the reason.
Unfortunately every motor home experience constant earthquakes when in motion, so all effort is only so effective. That is why it's best not to have open space inside cabinets, and contain the small stuff in tote containers.