0

I have this xml:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
  <TextView
      android:id="@+id/account_display_name"
      style="@style/AccountDataDisplayName"
      android:layout_width="wrap_content"
      android:layout_height="0dp"
      android:layout_weight="1"
      android:gravity="center_vertical"/>
  <TextView
      android:id="@+id/account_name"
      style="@style/AccountDataAccountName"
      android:paddingTop="-10dp"
      android:layout_width="wrap_content"
      android:layout_height="0dp"
      android:layout_weight="1"
      android:gravity="center_vertical"/>
</LinearLayout>

But I see when I change the paddingTop it doesn't effect the textView position. Why is that and how can i make the second textView higher positioned?

Elad Benda
  • 35,076
  • 87
  • 265
  • 471

1 Answers1

0

1) You are using "center_vertical" which centers the text and the padding starts from there. 2) Negative values are not supported only positive values are. I think just remove the "center_vertical" and add positive padding.

Itamar Kerbel
  • 2,508
  • 1
  • 22
  • 29
  • what do you mean `Second negative values are not supported `? in linear layout specifically? – Elad Benda Sep 30 '18 at 09:01
  • :). I wrote First.... and Second.... (meaning my second point). So to make it clear: negative values are not supported only positive values are – Itamar Kerbel Sep 30 '18 at 09:44