android textview align (right programmatically) code example Example: android textview center align text programmatically yourTextView.setGravity(Gravity.CENTER);