You should use the addRule method of the RelativeLayout.LayoutParams class.
layoutparams.addRule(RelativeLayout.CENTER_HORIZONTAL);
mTextView.setLayoutParams(layoutParams);
You should use the addRule method of the RelativeLayout.LayoutParams class.
layoutparams.addRule(RelativeLayout.CENTER_HORIZONTAL);
mTextView.setLayoutParams(layoutParams);