java.lang.Object | ||
↳ | com.neomades.ui.View | |
↳ | com.neomades.ui.TextEdit |
![]() |
![]() |
XML Attributes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Attribute Name | Related Method | Description | |||||||||
autoCorrect | setAutoCorrect(boolean) | Auto-correct mode | |||||||||
capitalizeMode | setCapitalizeMode(CapitalizeMode) | Capitalize mode | |||||||||
contentAlignment | setContentAlignment(int) | A combination of alignment values (eg: TOP|LEFT) | |||||||||
cursorPosition | setCursorPosition(int) | The caret position | |||||||||
defaultText | setDefaultText(int) | Res.string.XXXX or a text | |||||||||
font | setFont(Font) | Font resource id: Res.font.FONT_XXXX | |||||||||
maxLength | setMaxLength(int) | Max number of characters | |||||||||
passwordMode | setPasswordMode(boolean) | If the field hides characters | |||||||||
readOnly | setReadOnly(boolean) | If the text inside is not editable | |||||||||
text | setText(int) | Res.string.XXXX or a text | |||||||||
textColor | setTextColor(Color) | #AARRGGBB or a color | |||||||||
textMode | setTextMode(TextMode) | The text mode | |||||||||
textSize | setTextSize(int) | a size in dp |
[Expand]
Inherited XML Attributes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
TextEdit() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
clear()
Removes the text of this field
| ||||||||||
String |
getDefaultText()
Gets the default text of this text field.
| ||||||||||
String |
getText()
Returns the text of this text field.
| ||||||||||
boolean |
isReadOnly()
Returns if the the field is readonly or can be edited
| ||||||||||
int |
length()
Returns the length of the text of this field
| ||||||||||
void |
setAutoCorrect(boolean autocorrect)
Sets if auto-correct should be enabled.
| ||||||||||
void |
setCapitalizeMode(CapitalizeMode mode)
Changes the capitalize mode.
| ||||||||||
void |
setContentAlignment(int alignment)
Sets the alignment of the text in this component.
| ||||||||||
void |
setCursorPosition(int index)
Moves the cursor position before the character at the given index.
| ||||||||||
void |
setDefaultText(String defaultText)
Sets the default text of this text field, it disappears when the first
character is entered and reappears when all characters have been deleted.
| ||||||||||
void |
setDefaultText(int resId)
Sets the default text of this text field, it disappears when the first
character is entered and reappears when all characters have been deleted.
| ||||||||||
void |
setFont(Font font)
Sets the font for this text field
| ||||||||||
void |
setMaxLength(int maxLength)
Sets the maximum number of authorized characters into this
TextField . | ||||||||||
void |
setPasswordMode(boolean passwordMode)
Sets the password mode.
| ||||||||||
void |
setReadOnly(boolean readonly)
Sets the state of this field to readonly or editable
| ||||||||||
void |
setReturnKeyListener(ReturnKeyListener returnKeyListener)
Associates a
ReturnKeyListener to this TextField . | ||||||||||
void |
setReturnKeyType(int returnKeyType)
Changes the content of the return key.
| ||||||||||
void |
setText(String text)
Sets the text of this text field
| ||||||||||
void |
setText(int resId)
Sets the text of the text field
| ||||||||||
void |
setTextChangedListener(TextChangedListener listener)
Sets a text change listener (called when the text has been changed by the
user)
| ||||||||||
void |
setTextColor(Color color)
Sets the text color of this textfield's text
| ||||||||||
void |
setTextMode(TextMode mode)
Changes the text mode.
| ||||||||||
void |
setTextSize(int sizeInDp)
Sets the text size to a given value (in dp).
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
A combination of alignment values (eg: TOP|LEFT)
Removes the text of this field
CrossThreadException | if the method is called from outside the UI-Thread |
---|
Gets the default text of this text field. Returns an empty string ("") if there is no text.
Returns the text of this text field. Returns an empty string ("") if there is no text.
Returns if the the field is readonly or can be edited
Returns the length of the text of this field
Sets if auto-correct should be enabled. If enabled, text may be corrected
automatically while the user is typing.
By default, the auto-correct option is activated.
With auto-correct mode often comes a suggestions list, that is displayed
above the keyboard.
When the keyboard is opened, changing the auto-correct mode may not take
effect immediately, but only after the keyboard is re-opened.
autocorrect | true to activate auto-correct, else false |
---|
Changes the capitalize mode. See CapitalizeMode
for a list of
possible values.
The capitalize mode does not enforce users to use the specified case, it is
just a hint. The user can still change the mode explicitly on the keyboard.
mode | the capitalize mode to apply to this text edit |
---|
NullPointerException | if the parameter is null |
---|
Sets the alignment of the text in this component. The alignment will be used
only if the text is smaller than the TextField size. (default :
VCENTER
|LEFT
)
In MATCH_CONTENT
mode, the
TextField
size is the same than the text size, then this alignment
property will be inefficient.
The parameter is a combination of values from Alignment
.
alignment | The new alignment of the text |
---|
CrossThreadException | if the method is called from outside the UI-Thread |
---|
Moves the cursor position before the character at the given index. The field must have the focus: if the cursor is not already displayed, this method will have no effect.
index | the new index |
---|
CrossThreadException | if the method is called from outside the UI-Thread |
---|---|
IndexOutOfBoundsException | if index is negative or larger than the text length |
Sets the default text of this text field, it disappears when the first character is entered and reappears when all characters have been deleted.
defaultText | the new default text |
---|
CrossThreadException | if the method is called from outside the UI-Thread |
---|
Sets the default text of this text field, it disappears when the first character is entered and reappears when all characters have been deleted.
resId | the string id representing the default text of this field |
---|
CrossThreadException | if the method is called from outside the UI-Thread |
---|
Sets the font for this text field
font | the new font to set |
---|
CrossThreadException | if the method is called from outside the UI-Thread |
---|---|
NullPointerException | if the font parameter is null |
Sets the password mode.
TextArea
.passwordMode | true to set password edition |
---|
CrossThreadException | if the method is called from outside the UI-Thread |
---|
Sets the state of this field to readonly or editable
readonly | true if the textfield could not be edited by the user |
---|
CrossThreadException | if the method is called from outside the UI-Thread |
---|
Associates a ReturnKeyListener
to this TextField
.
Required to customize the behavior of the application when the user presses
the "Return" key of the keyboard that was opened for this
TextField
.
returnKeyListener | the callback used to listen press event on "Return" for the keyboard of the TextField |
---|
Changes the content of the return key. Depending on the platform it can be a text or in image. The default content is a "Done" button.
Android
device running a specific constructor layer,
this method may have no effect (device running HTC Sense for example)returnKeyType | the ReturnKeyType of the keyboard for this TextField
|
---|
Sets the text of this text field
text | the new text |
---|
CrossThreadException | if the method is called from outside the UI-Thread |
---|
Sets the text of the text field
resId | the string id representing the text of this text field |
---|
CrossThreadException | if the method is called from outside the UI-Thread |
---|
Sets a text change listener (called when the text has been changed by the user)
listener | the callback used to listen text changes |
---|
Sets the text color of this textfield's text
color | The color to set (with the alpha channel) |
---|
CrossThreadException | if the method is called from outside the UI-Thread |
---|
Changes the text mode. See TextMode
for a list of possible values.
The text mode does not enforce users to use the specified keyboard, it is
just a hint. The user can still use characters that may differ from the
specified text mode, for example alphabetic characters instead of digits.
mode | the text mode to apply to this text edit |
---|
NullPointerException | if the parameter is null |
---|
Sets the text size to a given value (in dp).
sizeInDp | size to set to the text |
---|