-1

XML code----

 <TextView
            android:text="DOGS"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:textSize="24sp" />

XML code----

<TextView
                android:text="DOGS"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="24sp" />

when layout_height set 0dp produces the result which would be prouduce when layout_height set to wrap_content and its same for width as well. if both produces the same then why need the other.

  • check this answer https://stackoverflow.com/questions/7220404/what-is-the-trick-with-0dip-layout-height-or-layouth-width?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – Paraskevas Ntsounos Jun 05 '18 at 18:15

1 Answers1

1

Because android:textSize="24sp" setting height of your textview.

kbhaskar
  • 139
  • 8