The Note Form Cell¶
The note form cell is a subtype of the simple property form cell, but where the value is a
multiline editable text field. By default, the note form cell keeps expanding its height up to the specified maximum number of lines (default six) and, once the maximum is achieved, scrolls vertically to accommodate more lines. Like the simple property form cell, the note form cell also supports setting up helper or error texts.
For more information about the simple property form cell, see
Using the Note Form Cell¶
This form cell can be used within your activity like any traditional Android view:
<com.sap.cloud.mobile.fiori.formcell.NoteFormCell android:id="@+id/note" android:layout_width="match_parent" android:layout_height="wrap_content" />
Editable and Non-Editable Modes¶
Like the simple property form cell, the note form cell can also be set to be in non-editable mode, where the cell is enabled but the value field on the cell is not editable. By default, the form cell is editable. You can control the editability of the cell by using the
app:isEditable="false XML attribute. You can also fetch the view in your activity and set it to be non-editable:
NoteFormCell mNoteFormCell = findViewById(R.id.note); mNoteFormCell.setEditable(false);
For more information about the editable attribute, see
The note form cell also allows you to enable or disable the ability to select the value text in non-editable states. These cells are always
selectable if they are editable. However, if the cell is not editable then you can control the ability to select text by using the
As shown below, you can mix the
app:selectable attributes or corresponding methods to create different variants of the cell:
Error and Helper Text¶
To set the error and helper text on the view, enable the feature on the view by calling
You can also use the
app:helperEnabled XML attributes to enable the support for these features. Enabling errors also adds an error icon at the end of the value field. Once enabled, you can call
setError(CharSequence) to set the error text and
setHelperText to set the helper text. Once set, the error/helper text remains enabled, until
setErrorEnabled(false)/setHelperEnabled(false) is called.
Unlike the simple property form cell, the note form cell supports
multiline. You can control the number of lines supported using the
android:maxLines XML attribute of the view or you can call
setMaxLines(int) method to set the number of lines on the cell.
As shown below, the cell's values field behaves like Android's
EditText: the height of the view keeps expanding with an increasing number of lines until the number of lines reaches the maximum number of lines set on the cell. Afterwards, the value scrolls to accommodate more lines.