From wiki.ginstr.com
Jump to: navigation, search
 
(9 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
<div style="float:right; clear:both; margin-left:0.5em;">__TOC__</div>
 
<div style="float:right; clear:both; margin-left:0.5em;">__TOC__</div>
[[Category:Widget_Library]]
+
<span STYLE="font-size: xx-large"><code>TextView</code></span>
This is the standard [http://developer.android.com/reference/android/widget/TextView.html Android Widget]but it's outlined here because of its text display capabilities.[http://developer.android.com/reference/android/widget/TextView.html TextView]'s purpose is primarily  to display text but can also be used to contain links.
 
  
 
;Widget XML tag: <code><TextView></code>
 
;Widget XML tag: <code><TextView></code>
 +
 +
This is the standard [http://developer.android.com/reference/android/widget/TextView.html Android Widget] but it's outlined here because of its text display capabilities.<code>[http://developer.android.com/reference/android/widget/TextView.html TextView]</code>'s purpose is primarily  to display text but can also be used to contain links.
  
 
==XML Attributes Description==
 
==XML Attributes Description==
Line 11: Line 12:
 
! scope="col" | Description
 
! scope="col" | Description
 
|-
 
|-
| title="Attribute" | <code>[[#android:autoLink]]</code>
+
| title="Attribute" | <code>[[#android:autoLink|android:autoLink]]</code>
 
| title="Description" | Enables the linking of text to open web browser URLs, email client, etc.
 
| title="Description" | Enables the linking of text to open web browser URLs, email client, etc.
 
|-
 
|-
| title="Attribute" | <code>[[#android:text]]</code>
+
| title="Attribute" | <code>[[#android:text|android:text]]</code>
 
| title="Description" | Displays desired text in the TextView.
 
| title="Description" | Displays desired text in the TextView.
 
|}
 
|}
Line 30: Line 31:
 
;<code>&amp;lt;BR/&amp;gt;</code> (<code>&lt;BR/></code>): breaks line into a new row
 
;<code>&amp;lt;BR/&amp;gt;</code> (<code>&lt;BR/></code>): breaks line into a new row
 
;<code>&amp;lt;a href=\”mailto:email@ginstr.com\”&amp;gt;EMAIL&amp;lt;/a&amp;gt;</code> (<code><a href=”mailto:email@ginstr.com”>EMAIL</a></code>): creates an email link on the text <code>EMAIL</code> which is displayed in <code>[http://developer.android.com/reference/android/widget/TextView.html TextView]</code>. Clicking on it displays the menu for choosing an email program.
 
;<code>&amp;lt;a href=\”mailto:email@ginstr.com\”&amp;gt;EMAIL&amp;lt;/a&amp;gt;</code> (<code><a href=”mailto:email@ginstr.com”>EMAIL</a></code>): creates an email link on the text <code>EMAIL</code> which is displayed in <code>[http://developer.android.com/reference/android/widget/TextView.html TextView]</code>. Clicking on it displays the menu for choosing an email program.
;<code>&amp;lt;font color=&quot;#46b4e7&quot;&amp;gt;other color text&amp;lt;/font&amp;gt;</code> (<code><&lt;font color=”#46b4e7”&gt;other color text&lt;/font&gt;</code>):text that is within these tags will be a different color
+
;<code>&amp;lt;font color=&quot;#46b4e7&quot;&amp;gt;other colour text&amp;lt;/font&amp;gt;</code> (<code>&lt;font color=”#46b4e7”&gt;other colour text&lt;/font&gt;</code>):text that is within these tags will be a different colour
  
 
Tags can also be nested and there are many more that can be used. Refer to [http://developer.android.com/reference/android/widget/TextView.html Android Documentation] for more details on HTML and tags.
 
Tags can also be nested and there are many more that can be used. Refer to [http://developer.android.com/reference/android/widget/TextView.html Android Documentation] for more details on HTML and tags.
  
==android:autoLink==
+
==<code>android:autoLink</code>==
 
Enables the linking of text to open web browser URLs, email client, etc. Each link opens different intent  
 
Enables the linking of text to open web browser URLs, email client, etc. Each link opens different intent  
  
Line 60: Line 61:
 
|}
 
|}
  
==android:text==
+
==<code>android:text</code>==
 
Displays desired text in the TextView. It is possible to [[#Using HTML markup in text|use HTML tags to format text]].
 
Displays desired text in the TextView. It is possible to [[#Using HTML markup in text|use HTML tags to format text]].

Latest revision as of 11:56, 27 March 2017

TextView

Widget XML tag
<TextView>

This is the standard Android Widget but it's outlined here because of its text display capabilities.TextView's purpose is primarily to display text but can also be used to contain links.

XML Attributes Description

Attribute Description
android:autoLink Enables the linking of text to open web browser URLs, email client, etc.
android:text Displays desired text in the TextView.

Using HTML markup in text

When writing text within TextView or GnTextView the designer has the option to use HTML language to style the text displayed. A few tags will be elaborated on.

XML characters < and > are reserved for XML only. This means you need to write alternative symbols which represent them where < is &lt; and > is &gt;

The following text demonstrates how to use alternative symbols.

Character is also a reserved character and needs to be written as \“.

HTML mark-up tags:

&lt;BR/&gt; (<BR/>)
breaks line into a new row
&lt;a href=\”mailto:email@ginstr.com\”&gt;EMAIL&lt;/a&gt; (<a href=”mailto:email@ginstr.com”>EMAIL</a>)
creates an email link on the text EMAIL which is displayed in TextView. Clicking on it displays the menu for choosing an email program.
&lt;font color="#46b4e7"&gt;other colour text&lt;/font&gt; (<font color=”#46b4e7”>other colour text</font>)
text that is within these tags will be a different colour

Tags can also be nested and there are many more that can be used. Refer to Android Documentation for more details on HTML and tags.

android:autoLink

Enables the linking of text to open web browser URLs, email client, etc. Each link opens different intent

(String) values = none, web, email, phone, map, all

Value Description
none Matches no pattern
web Recognises web addresses and converts them to links
email Recognises web addresses and converts them to links
phone Recognises phone numbers and converts them to links
map Recognises map addresses and converts them to links

android:text

Displays desired text in the TextView. It is possible to use HTML tags to format text.