3
<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> 

我的Java代碼:什麼是所有根佈局Android中的父佈局

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

它會告訴你的FrameLayout是線性的父佈局layout.please告訴 1.框架佈局是怎麼線性佈局的父級佈局? 2.默認窗口有幀佈局?

請提前幫助我。

+0

廣告1 FrameLayout可以是包括LinearLayout在內的任何視圖的父級,請檢查它:Window.getDecorView() – pskink 2014-08-29 05:41:47

回答

1

你是對的,DecorView將使用FrameLayout來存儲應用程序設置的所有內容。你可以閱讀來源PhoneWindow

+0

謝謝suitaianshi.can你給我一個鏈接/源,所以我可以得到關於decorview的更多知識。理論內容不是一個進步內容 – Akashsingla19 2014-08-29 06:34:56

+0

對不起,我找不到一篇(足夠好的)關於它的文章。但我始終認爲源代碼是最好的教程。 – suitianshi 2014-08-29 06:37:19

+0

很好,謝謝你的幫助。 – Akashsingla19 2014-08-29 06:52:48