This article explains how to lock apps on an Android device. The instructions apply to all Android devices running Android 7.0 and later.
How to Lock an App on Android
Screen pinning locks an app in open view. If you try to close the app or open the home screen, the lock screen security entry will appear.
The menu options will differ depending on your Android version, but here are the steps for most Android phones:
Open Settings and tap Security & privacy > More security settings > App pinning.