The Note Form Cell¶
The note form cell is a subtype of the simply property form cell. Unlike this form cell, the note form cell represents a key value cell, in which the value is a multiline editable text field. By default, the note form cell keeps expanding the height up to the specified maximum number of lines (default 6) and afterwards scrolls vertically to accommodate more lines. Like the simply property form cell, the note form cell also supports facilities to set helper or error texts.
For more information about the simply property form cell, see SimplePropertyFormCell.
Using the Note Form Cell¶
This form cell can be used within your activity like any traditional Android view:
1 2 3 4
<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 simply property form cell, the note form cell can also be set to 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 XML attribute "app:editable="false". You can also fetch the view in your activity and set it to be editable:
NoteFormCell mNoteFormCell = findViewById(R.id.note); mNoteFormCell.setIsEditable(false);
The 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 setTextIsSelectable(boolean isSelectable) method.
As shown below, you can mix the "app:editable" and "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 setErrorEnabled and setHelperEnabled respectively.
You can also use "app:errorEnabled" and "app:helperEnabled" XML attributes to enable the support for these features. 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 simply property form cell, the note form cell supports multiline. You can control the number of lines supported using "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 increasing number of lines until the number of lines reach the max number of lines set on the cell. Afterwards, the value scrolls to accommodate more lines.