What is the parent layout of All Root layout in Android

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/linearLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
>

<TextView
    android:id="@+id/textView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/hello_world" 
    />
</LinearLayout> 

      

My Java code:

linearLayout=(LinearLayout) findViewById(R.id.linearLayout);
System.out.println(linearLayout.getParent());

      

it will show you that framelayout is the parent of the linear layout.please tell 1. How is the layout of the layout the parent of the linear layout? 2. Does the window have a frame layout by default?

Please help me .thanks in advance.

+3


source to share


1 answer


You are right, DecorView

will use FrameLayout

to store all the content installed by applications. You can read the sourcePhoneWindow



+1


source







All Articles