Мое приложение, получившее сбой при прохождении ниже ошибок для scrollview, даже дочерние элементы сгруппированы в виде родителя. это происходит только тогда, когда интернет выключен, иначе он работает.Прокрутить список, создавая причину аварии
02-22 14:26:20.504 13277-13277/com.eonelectric.eon E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.eonelectric.eon, PID: 13277
java.lang.IllegalStateException: ScrollView can host only one direct child
at android.widget.ScrollView.addView(ScrollView.java:248)
at android.support.design.widget.Snackbar.showView(Snackbar.java:483)
at android.support.design.widget.Snackbar$1.handleMessage(Snackbar.java:167)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5343)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
My layout file is here.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:fillViewport="true">
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="@+id/loginBackgroundIv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@drawable/login_bg"
tools:ignore="ContentDescription"/>
<de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/profilePicIv"
android:layout_width="135dp"
android:layout_height="110dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="16dp"
android:scaleType="centerCrop"
android:src="@drawable/user"
app:civ_border_color="#fff"
app:civ_border_width="2dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="130dp"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:id="@+id/nameWraper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/nameEt"
style="@style/custom_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:singleLine="true"
android:textColor="#ffffff" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/phoneWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/phoneEt"
style="@style/custom_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:maxLength="10"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/emailWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/emailEt"
style="@style/custom_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<LinearLayout
android:id="@+id/pwdLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:id="@+id/pwdwrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/pwdEt"
style="@style/custom_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textWebPassword"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/repwdwrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/repwdEt"
style="@style/custom_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textWebPassword"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<!--<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="100">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="40"
android:padding="8dp"
android:text="User type ?"
android:textColor="@android:color/white"
android:textSize="16sp" />
<Spinner
android:id="@+id/userTypeSpinner"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="60"
android:entries="@array/userTypeArray" />
</LinearLayout>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="100">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="40"
android:padding="8dp"
android:text="State ?"
android:textColor="@android:color/white"
android:textSize="16sp" />
<Spinner
android:id="@+id/stateSpinner"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="60" />
</LinearLayout>
<LinearLayout
android:id="@+id/empLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="visible">
<android.support.design.widget.TextInputLayout
android:id="@+id/empCodeWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/empCodeEt"
style="@style/custom_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<!--<android.support.design.widget.TextInputLayout
android:id="@+id/empDivCodeWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/empDivCodeEt"
style="@style/custom_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>-->
</LinearLayout>
<Button
android:id="@+id/finishSignupBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="Sign Up"
android:textColor="@android:color/white" />
</LinearLayout>
</FrameLayout>
</ScrollView>
Пожалуйста, сообщайте код деятельности –
Как ошибка говорит. Вам нужно обернуть дочерний макет в линейных макетах и запустить –
Возможный дубликат [Как я могу избежать »IllegalStateException: Scrollview может содержать только один прямой дочерний элемент?] (Http://stackoverflow.com/questions/3735095/how-can- я-избежать-IllegalStateException-Scrollview-хост может-только-один-прямой Чиль) –