Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 framelayout is the parent layout of linear layout.please tell 1. how frame layout is the parent layout of linear layout? 2. by Default window has frame layout?

Please help me.thanks in advance.

like image 732
Akashsingla19 Avatar asked Nov 24 '25 05:11

Akashsingla19


1 Answers

You're right, DecorView will use a FrameLayout to store all the content set by applications. You can read the source of PhoneWindow

like image 130
suitianshi Avatar answered Nov 25 '25 20:11

suitianshi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!