Text
Widget is used for textual input of data by user. Value will be stored as datatype TEXT.
Back to ginstr app composer reference
Predefined user data
To read specification and understand it better we will assume that
- name of the page to which widgets are added = "page one"
- user entered the following data for the widget:
- label name = "first name"
- hint for input field = "please enter first name"
- table name = "users"
Widget references
If widget is added via app composer autogenerated ids will be created according to table below.
Control | Attribute | Value |
---|---|---|
TextView | android:id | @+id/pageOneFirstNameLabel |
TextView | android:text | @string/pageOneFirstNameLabel |
GnEditText | android:id | @+id/pageOnefirstName |
GnEditText | ek:s_hint | @string/pageOneFirstNameHint |
TextView | ek:style | @style/textTextView |
GnEditText | ek:style | @style/textGnEditText |
Attributes configuration
TextView
Preset attributes:
Attribute | Value |
---|---|
android:id | @+id/pageOneFirstNameLabel |
android:layout_width | match_parent |
android:layout_height | wrap_content |
ek:style | @style/textTextView |
User defined attributes:
Attribute | Value |
---|---|
android:text | @string/pageOneFirstName |
GnEditText
Represents the internal organization of a widget:
Preset attributes:
Attribute | Value |
---|---|
android:id | @+id/pageOneFirstName |
android:layout_width | match_parent |
android:layout_height | wrap_content |
ek:data_type | text |
ek:style | textGnEditText |
User defined attributes:
Attribute | Value |
---|---|
ek:s_hint | @string/pageOneFirstNameHint |
Code snippets
Common widget code
<source lang="xml"> <TextView
android:id="@+id/pageOneFirstNameLabel" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/pageOneFirstName" ek:style="@style/textTextView"/>
<com.ginstr.widgets.GnEditText
android:id="@+id/pageOneFirstName" android:layout_width="match_parent" android:layout_height="wrap_content" ek:s_hint="@string/pageOneFirstNameHint" ek:data_type="text" ek:inputType="TEXT" ek:style="@style/textGnEditText" --variant content goes here--/>
</source>
strings.xml
Lines to be added for EN language
<source lang="xml"> <string name="pageOneFirstNameLabel">first name</string> <string name="pageOneFirstNameHint">please enter first name</string> </source>
Lines to be added for DE language
<source lang="xml"> <string name="pageOneFirstNameLabel">first name</string> <string name="pageOneFirstNameHint">please enter first name</string> </source>
Prompts
- User will be prompted to enter value for parameter "pageOneFirstNameLabel"
- User will be prompted to enter value for parameter "pageOneFirstNameHint"
Text editable variant
Widget code
<source lang="xml"> <--variant content
ek:s_sourceType="input"
</source>
Text read only variant
Widget code
<source lang="xml"><
ek:s_sourceType="input" ek:focusable="false"
</source>
Nfc variant
Widget code
<source lang="xml"><
ek:s_sourceType="nfc"
</source>
Barcode variant
Widget code
<source lang="xml"><
ek:s_sourceType="qr"
</source>