android - Android中All Root布局的父布局是什么

标签 android android-linearlayout parent-child android-framelayout gravity

<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 代码:

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

它会告诉你 framelayout 是线性布局的父布局。请告诉 1. frame布局怎么是线性布局的父布局? 2.默认窗口有框架布局?

请帮助我。提前致谢。

最佳答案

没错,DecorView 将使用一个FrameLayout 来存储应用程序设置的所有内容。您可以阅读 PhoneWindow 的来源

关于android - Android中All Root布局的父布局是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25562221/

相关文章:

android - 如何清除 Android 堆栈中的所有现有 Activity

android - shrinkResources true 不能用于 Instant Apps 功能?

android - 所有自定义 View 实例变量均为 null

android - 显示嵌套的 LinearLayout 时出错

android - 小部件纵横比 1 :1 (square)

reactjs - 子组件未在 React js 中渲染

android - 预定同步适配器每 30 秒运行一次

php - Laravel 4 - Eloquent 。无限的 child ​​变成可用的数组?

不同 child 的C#继承倍数

android - android 中的 putExtra()