This article is only for absolute beginners. This article is for those who just started learning Android. This will give you a basic idea about TextView in a simple and short way.
TextView in Android is used to display texts. It does not allow the user to edit the texts in it.
In this post, we are going to discuss TextView in detail and how to use it.

TextView from layout XML file:

As you can see in the above code, we have used four basic properties width, height, text, and textSize. There are many other properties, but for simplicity, we have used only these four properties for now.

More articles on Android:

Toast message and positioning – Android

Network connection checking – Android

Here android:layout_width=”wrap_content” and android:layout_height=”wrap_content”, these two are mandatory properties. Using android:layout_width=”wrap_content”, you can set the width of your TextView and using  android:layout_height=”wrap_content”, you can set the height of your TextView.

To set the text of your TextView you can use this android:text=” ” property. And to set the size of the TextView text, the property is android:textSize=” “ 

You have to place a TextView inside a root layout. i.e LinearLayout, RelativeLayout.

So the complete code will look something like this:

Now when you run the app, the output will look like this:


Though the TextView in Android is not editable, you can make it selectable. So that user can select and copy texts from the TextView.

There is a property, android:textIsSelctable=” “, to make it selectable set the property to true.

If you have any doubts or query, please don’t hesitate to comment below in the comment section.

TextView Android tutorial for absolute beginners
Tagged on:

One thought on “TextView Android tutorial for absolute beginners

  • April 16, 2017 at 8:08 am

    Excellent post. Keep writing such kind of information on your
    blog. Im really impressed by your site.
    Hi there, You’ve performed a great job. I will certainly digg it and personally recommend to my friends.
    I am sure they’ll be benefited from this website.


Leave a Reply

Your email address will not be published. Required fields are marked *