抱歉,我是 Android 新手
由于我的内容很大,我将创建一个 ScrollView
。通过这种方式,我在 1 个文件中创建了内容的某些部分(我们将其称为 FirstLayout.xml),并将另一部分创建为 SeconedLayout.xml。现在我将在一个 XML 文件中调用它们。(Parent.xml)
但问题是,我不知道,我应该如何在我的 ScrollView 中调用它们?
这是代码
FirstLayout.xml
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
.
.
.
</AbsoluteLayout>
SeconedLayout.xml 是:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
...
</LinearLayout>
Parent.xml
可见
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroller"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
<!-- Call FirstLayout -->
<!-- Call SecondLayout -->
</ScrollView>
最佳答案
您应该使用包含标签:
<include
layout="@layout/SeconedLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
关于android - 在另一个android布局中调用一个android布局来制作嵌套布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16684483/