Good afternoon, I'm trying to add a ScrollView
but it's not working, the xml
file is:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="20dp"
tools:context="matgic.com.matgic.MainActivity"
>
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="vertical">
<TextView
android:id="@+id/selidio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#faf8f8"
android:text="@string/sel_idio"
android:layout_gravity="center"
android:textSize="30sp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
/>
<TextView
android:id="@+id/sellan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fcfbfb"
android:text="@string/sel_lan"
android:layout_gravity="center"
android:textSize="30sp"
android:layout_below="@id/selidio"
android:layout_centerHorizontal="true"
/>
<ImageButton
android:id="@+id/es"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
app:srcCompat="@drawable/espaniol"
/>
<ImageButton
android:id="@+id/en"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
app:srcCompat="@drawable/english"
/>
</ScrollView>
</RelativeLayout>
This error displays in Stack Trace
:
java.lang.IllegalStateException: ScrollView can host only one direct child at android.widget.ScrollView.addView (ScrollView.java:279) at android.view.LayoutInflater.rInflate_Original (LayoutInflater.java:867) at android.view.LayoutInflater_Delegate.rInflate (LayoutInflater_Delegate.java:72) at android.view.LayoutInflater.rInflate (LayoutInflater.java:837) at android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:824) at android.view.LayoutInflater.rInflate_Original (LayoutInflater.java:866) at android.view.LayoutInflater_Delegate.rInflate (LayoutInflater_Delegate.java:72) at android.view.LayoutInflater.rInflate (LayoutInflater.java:837) at android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:824) at android.view.LayoutInflater.inflate (LayoutInflater.java:515) at android.view.LayoutInflater.inflate (LayoutInflater.java:394) at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate (RenderSessionImpl.java:325) at com.android.layoutlib.bridge.Bridge.createSession (Bridge.java:384) at com.android.tools.idea.layoutlib.LayoutLibrary.createSession (LayoutLibrary.java:193) at com.android.tools.idea.rendering.RenderTask.createRenderSession (RenderTask.java:547) at com.android.tools.idea.rendering.RenderTask.lambda $ inflate $ 3 (RenderTask.java:681) at java.util.concurrent.FutureTask.run (FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:617) at java.lang.Thread.run (Thread.java:745)