Textview

Android Parsing HTML Content Containing Links

Place a link inside a HTML Content using TextView. Use links in textview.

Android AutoCompleteTextView Example

In android, we can show a string items in autocompletetextview. So that items will display according to the characters we have give. Ex:- If we are giving 'an' it will show all the items starts with 'an'.

Android HTML View

In android, we can use some HTML Tags for text.

Android Textview Scrollable

We can set scrollview to textview, so that we can scroll the textview when there is more text.

[sourcecode language="xml"]

<ScrollView android:id="@+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="70px">
<TextView android:id="@+id/TEXT_VIEW"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This is an example for android textview scrollbale. by www.androidpeople.com. You can get more tutorials in www.androidpeople.com.

Android Textview Border

We cannot set border to textview directly because there is no property to set border for textview.

But we can give background color to Tablelayout & Textview.

Android Textview Font

In Android, we can set the font to textview by using the textview property.

  • 'android:textSize' for Textview Size
  • 'android:textStyle' for Textview Text Style
  • 'android:typeface' for Textview Font Style

Textview Font Example -

[sourcecode language="xml"]

<TextView android:text="@+id/TextView01"
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20px"
android:textStyle="bold"
android:typeface="s

Android Textview Background Color

Here we are going to see an example for setting the Android textview background color...

[sourcecode language="css"]

<TextView android:background="#ff23cf"
android:text="@+id/TextView01"
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

[/sourcecode]

By using theĀ android:background="#ff23cf" piece of code the textview background will be filled with #ff23cf color.<

Android Textview Aligment

Here we are going to see about how to set textview alignment in Android.

It is very simple to set Android textview alignment to the center, right or left etc..

Example for Android textview alignment -

To align a textview we need to use the 'gravity' property

[sourcecode language="xml"]
<TextView android:text="@+id/TextView01"
android:id="@+id/TextView01"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:gravity="center" />
[/sourcecode]

Now we set the alignment to center

Android Text Color

In Android, we can set text color for textview, edittext, buttons, etc...

Example:-

Input

Output

Android Textview Tutorial

In this tutorial, we are going to learn about TextView.

In Android if we start any application, we may need to use TextView.

Textview is a View which we can add to any Layout.

How to add TextView in a Layout?

To add a textview to a layout, select the layout you need to add (here I have selected LinearLayout01) & then click the Add Button (shown in green color with plus symbol intimating "Adds a new element")

Syndicate content