Reputation: 743
How can I make position center of long textView in layout at android.I used android:gravity="center" in layout but it didn't for the TextView has a long text.How can I solve this problem?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/memorialvodafonebackground_2"
android:gravity="center"
android:orientation="vertical"
>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ekranda adınız göründükten sonra hastanemizi değerlendirmenizden memnuniyet duyacağız"
android:textColor="@color/black"
android:textSize="40dp" />
</LinearLayout>
Upvotes: 0
Views: 66
Reputation: 1133
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ekranda adınız göründükten sonra hastanemizi değerlendirmenizden emnuniyet duyacağız"
android:gravity="center"
android:singleLine="true"
android:textColor="@color/black"
android:textSize="40dp" />
Upvotes: 0
Reputation: 3993
Try Replacing:
android:gravity="center"
to
android:layout_gravity="center"
Like this:
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Ekranda adınız göründükten sonra hastanemizi değerlendirmenizden memnuniyet duyacağız"
android:textColor="@color/black"
android:textSize="40sp" />
Upvotes: 0
Reputation: 28823
Use
android:layout_gravity="center"
for TextView
android:gravity
- sets the gravity of the content of the View its used on.
android:layout_gravity
- sets the gravity of the View or Layout in its parent.
Hope this helps.
Upvotes: 1