android textview center tutorial

      Comments Off on android textview center tutorial

android textview center tutorial

android textview center

android textview center tutorial contains the both type of code xml and programmatically. You can set align of textview in center in many ways and sometimes it depends on the layout also, If you are using linear layout it may work differntly and if you are using android relative layout then it may work differently.

Here is the example on how to center android textview using xml and in android LinearLayout

android:text=”I am in Center”

In another way, You need to set attribute for terview center is:



Android Textview center programmatically:

textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL);



Android Textview Center in Android RelativeLayout




If you like my android tutorial, Kindly share with your friends and subscribe to get my all article by email. You can also check out more android tutorial using followig link:

android tutorial step by step guide

android editttext validation

android textview underline

android textview color

android animation

Personal Development Category (English)728x90