Sat. Jul 2nd, 2022


The Android TextView component is a View subclass which is capable of showing text. Being a subclass of View the TextView component can be used in your Android app’s GUI inside a ViewGroup, or as the content view of an activity.

Properties of TextView:

text: defines the text that would be displayed on the screen.

textStyle: sets the style of the text. The possible choices are bold, italic and normal.fontFamily: specifies the font family for the text.

typeFace: as you can imagine it defines the typeface for the text. The possible values are normal, sans, serif and monospace.

textSize: defines the size of the text. It is recommended to use sp for the size.

textColor: sets the color of the text. The color has to be defined in hex encoding or as a reference to another resource.

lines: defines the exact height of the TextView in lines.

The above properties we mentioned in XML file like below code. Here we specified content (text) manually xml file itself.


For the above textview am assigning text dynamically from java with below code

TextView textView;
textView= (TextView) findViewById(;
textView.setText("Hi Hello Good morning");

By Rajashekar

I’m (Rajashekar) a core Android developer with complimenting skills as a web developer from India. I cherish taking up complex problems and turning them into beautiful interfaces. My love for decrypting the logic and structure of coding keeps me pushing towards writing elegant and proficient code, whether it is Android, PHP, Flutter or any other platforms. You would find me involved in cuisines, reading, travelling during my leisure hours.

Leave a Reply

Your email address will not be published.