This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/android/knowledge-base/making-form-elements-read-only.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. How to make form elements read-only

If you want to make certain form elements in your document read-only, you can set the AnnotationFlags.LOCKEDCONTENTS flag on the associated WidgetAnnotation. While the form elements will still be displayed in the document, clicking on them won’t start the form editing view, in turn making them read-only:

List<FormElement> formElements = document.getFormProvider().getFormElements();
for (FormElement formElement : formElements) {
// This will prevent the user from making changes to this form element.
formElement.getAnnotation()
.setFlags(EnumSet.of(AnnotationFlags.LOCKEDCONTENTS));
}