I am displaying the TextView within a RelativeLayout.
I want to put the TextView at the center of the Layout.
Within the layout xml,
for TextView am using the property android:gravity="center" is not working .
I do not want to hard code by using android:layout_marginLeft or Right since it can give different effect in portrait or landscape mode.
Is there property so that it looks the same for both landscape & portrait mode & the TextView occupies the center of the Layout
Since
RelativeLayoutis yourTextView‘s parent, you simply setandroid:layout_centerInParent="true"on yourTextView. No other properties are needed.