java - TextView align center - Android -


i have text view this,

<textview     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:textappearance="?android:attr/textappearancelarge"     android:text="large text"     android:id="@+id/textview"     android:layout_centerhorizontal="true"/> 

it aligned in center horizontally, want move 20p left center. tried android:layout_marginstart="30dp" android:layout_marginleft="30dp"

but stayed in middle how can move left, have reference center?

here full xml

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context="com.spencer.one.splashscreenactivity">  <textview     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:textappearance="?android:attr/textappearancelarge"     android:text="large text"     android:id="@+id/textview"     android:layout_centerhorizontal="true"     android:layout_marginstart="30dp"     android:layout_marginleft="30dp"/> </relativelayout> 

thanks

<textview         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:textappearance="?android:attr/textappearancelarge"         android:text="large text"         android:id="@+id/textview"         android:layout_marginleft="30dp"         android:gravity="center"/> 

the content center inside textview , 30dp marginleft

enter image description here


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -