nUIFloatingEntry
com.softwareag.mobile.runtime.nui.nUIFloatingEntry
Use to provide a text-entry element that allows any hint-text set to float above the user-entered text as a label.
Usage Notes
For Android devices, the
error color and
label color attributes are ignored, and the system-defaults are used. You can modify these on an app-wide basis with XML styles. The space allocated to prefix and postfix hint-texts or images is identical on both sides and therefore is influenced by the larger of the two values.
With iOS devices, the
error text attribute occupies the same space as the floating label. This means that both cannot be visible at the same time. When enabled, the error text will always take priority over the floating label.
Example
This code sample creates an empty nUIFloatingEntry and sets the floating hint to "Family Name". An IStringValidator is used to detect @ characters inside the string and switch the nUIFloatingEntry into error mode if any are detected. Details on how the example code is rendered on various platforms follow the code sample.
nUIFloatingEntry fe = new nUIFloatingEntry("");
fe.setHintText("Family Name");
fe.setErrorText("No '@' allowed here.");
fe.setStringValidator(new IStringValidator()
{
public boolean accept(String s)
{
return (s.indexOf('@') < 0);
}
});
view.add(fe);
Platform | Platform-Specific Class and Visual Reference |
Android | TextInputLayout with a TextInputEditText |
iOS | Custom implementation based around JVFloatLabeledTextField and JVFloatLabelledTextView |