The button to exit your inventory is the same as the one you use to open it, by default it is the 'E' key.
Chat with our AI personalities
Pressing 'E' will open your inventory.
Tap the 3 dots next to where it shows your inventory.
to keep inventory you can do /gamerule keepinventory true or /gamerule keepinventory false
Do you see the three white dots on the bottom of the screen? That is the inventory
you press "E" (previously "I")