【发布时间】:2014-08-29 05:34:09
【问题描述】:
<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.框架布局是线性布局的父布局如何? 2. 默认窗口有框架布局?
请帮助我。提前谢谢。
【问题讨论】:
-
ad 1 FrameLayout 可以是任何 View 的父级,包括 LinearLayout,ad 2 检查它:Window.getDecorView()
标签: android android-linearlayout parent-child android-framelayout gravity