Я хочу добавить scrollview в свое приложение. Приложение содержит два линейных макета, в которых я динамически добавляю данные. Я хочу прокрутить весь экран, чтобы он отображал все данные. Когда я пытаюсь добавить его, появляется ошибка: «В представлении прокрутки может быть только один ребенок». Как добавить Scrollview в layout.xml?Как добавить ScrollView для этого макета?
Вот мой layout.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:id="@+id/myapp"
tools:context=".MainActivity" >
<ImageView
android:id="@+id/my_logo"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:src="@drawable/my_logo"
>
</ImageView>
<TextView
android:id="@+id/label1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/label1"
android:layout_below="@id/my_logo" />
<Spinner
android:id="@+id/spinner1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/label1"/>
<TextView
android:id="@+id/label2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/spinner1"
android:text="@string/label2" />
<Spinner
android:id="@+id/spinner2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/label2"/>
<TextView
android:id="@+id/label3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/spinner2"
android:text="@string/label3" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/list"
android:layout_below="@id/label3"
>
</LinearLayout>
<Button
android:id="@+id/submit_button"
android:layout_below="@id/list2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/submit_button"/>
<TextView
android:id="@+id/label4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/submit_button"
android:text="@string/label4" />
<LinearLayout
android:id="@+id/my_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_below="@id/label4" />
</RelativeLayout>
Просто положи Относительное расположение внутри Scrollview он будет делать трюк – krishna
Как добавить колонтитул изображение в том же макете? Когда я добавил изображение нижнего колонтитула, он перекрывается с динамическими данными. – tushAR