committedandroider
committedandroider

Reputation: 9261

What is the parent of the linear layout in my code?

This is my code currently

<LinearLayout 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:orientation="horizontal" >

   <EditText android:id="@+id/edit_message"
       android:layout_weight = "1"
       android:layout_width = "0dp"
       android:layout_height= "wrap_content"
       android:hint = "@string/edit_message" />
   <Button
       android:layout_width = "wrap_content"
       android:layout_height= "wrap_content"
       android:text = "@string/submit"
       android:onClick = "sendMessage"  />


</LinearLayout>

I researched the term match_parent and found it to be to match "size of parent layout"(Src: http://www.simplecodestuffs.com/difference-between-wrap-content-and-fill-parentmatch-parent/)

For a button if i specify match_parent, i know the parent would be the linear layout. My question if i specify match_parent on the linear layout, what parent would it match? What would be the term for that parent?

Upvotes: 0

Views: 52

Answers (1)

elvisrusu
elvisrusu

Reputation: 378

The parent for that LinearLayout can be an activity (so the LinearLayout will be as big as the screen of your device ), or a fragment , or a list/grid item e.t.c. Bassically any viewgroup in witch you include your layout.

Upvotes: 2

Related Questions