Fragment.UserVisibleHint Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Set a hint to the system about whether this fragment's UI is currently visible to the user.
public virtual bool UserVisibleHint { [Android.Runtime.Register("getUserVisibleHint", "()Z", "GetGetUserVisibleHintHandler")] get; [Android.Runtime.Register("setUserVisibleHint", "(Z)V", "GetSetUserVisibleHint_ZHandler")] set; }
[<get: Android.Runtime.Register("getUserVisibleHint", "()Z", "GetGetUserVisibleHintHandler")>]
[<set: Android.Runtime.Register("setUserVisibleHint", "(Z)V", "GetSetUserVisibleHint_ZHandler")>]
member this.UserVisibleHint : bool with get, set
Property Value
The current value of the user-visible hint on this fragment.
- Attributes
Remarks
The hint defaults to true and is retained when the fragment's state is saved and restored. Set it to false when the fragment's UI is not directly visible. The system may use the hint to prioritize lifecycle updates or loader ordering.
This property can be set outside the fragment lifecycle, so its setter has no ordering guarantees relative to lifecycle methods. On Android 5.0 through Android 6.0, setting the hint can start a fragment before its transaction is committed. On Android 7.0 and later, this behavior is preserved for apps targeting API level 23 or lower.
Android reference for android.app.Fragment.getUserVisibleHint.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.