NestedScrollView и RecleView не работают вместе - PullRequest
0 голосов
/ 07 ноября 2019

Я пытаюсь создать макет Android-формы. В нижнем колонтитуле есть одна кнопка фиксированная кнопка. У меня есть много элементов на экране, для этого я хочу прокрутить макет, чтобы пользователь мог легко видеть все элементы формы. В конце элементов я хочу показать вид recycle. Я написал код ниже, но я получаю ошибку, которая упоминается ниже. Как я могу устранить ошибку ниже?

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/relativeLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white"
    tools:context=".activity.MainActivity">

    <Button
        android:id="@+id/btnNext"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="@color/colorPrimary"
        android:text="Close or reject"
        android:textColor="@color/white"
        android:textSize="@dimen/text_size_normal"
        android:textStyle="bold"
        android:visibility="gone" />



    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="50dp"
        android:padding="15dp"
        android:scrollbars="none">

        <LinearLayout
            android:id="@+id/linearLayout1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:minHeight="40dp"
                android:orientation="horizontal"
                android:paddingTop="5dp"
                android:paddingBottom="5dp"
                android:weightSum="1">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.4"
                    android:text="Line stop no."
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />

                <TextView
                    android:id="@+id/txtLineStopNo"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.6"
                    android:text=""
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:minHeight="40dp"
                android:orientation="horizontal"
                android:paddingTop="5dp"
                android:paddingBottom="5dp"
                android:weightSum="1">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.4"
                    android:text="Function"
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />

                <TextView
                    android:id="@+id/txtFunctionName"
                    android:layout_width="0dp"
                    android:layout_height="40dp"
                    android:layout_weight="0.6"
                    android:background="@color/btn_login_bg"
                    android:gravity="center_vertical"
                    android:hint=""
                    android:paddingLeft="10dp"
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:minHeight="40dp"
                android:orientation="horizontal"
                android:paddingTop="5dp"
                android:paddingBottom="5dp"
                android:weightSum="1">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.4"
                    android:text="Product family"
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />

                <TextView
                    android:id="@+id/txtProductFamilyName"
                    android:layout_width="0dp"
                    android:layout_height="40dp"
                    android:layout_weight="0.6"
                    android:background="@color/btn_login_bg"
                    android:gravity="center_vertical"
                    android:hint=""
                    android:paddingLeft="10dp"
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:minHeight="40dp"
                android:orientation="horizontal"
                android:paddingTop="5dp"
                android:paddingBottom="5dp"
                android:weightSum="1">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.4"
                    android:text="Line description"
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />

                <TextView
                    android:id="@+id/txtLineDescription"
                    android:layout_width="0dp"
                    android:layout_height="40dp"
                    android:layout_weight="0.6"
                    android:background="@color/btn_login_bg"
                    android:gravity="center_vertical"
                    android:hint=""
                    android:paddingLeft="10dp"
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:minHeight="40dp"
                android:orientation="horizontal"
                android:paddingTop="5dp"
                android:paddingBottom="5dp"
                android:weightSum="1">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.4"
                    android:text="Reason category"
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />

                <TextView
                    android:id="@+id/txtReasonCategory"
                    android:layout_width="0dp"
                    android:layout_height="40dp"
                    android:layout_weight="0.6"
                    android:background="@color/btn_login_bg"
                    android:gravity="center_vertical"
                    android:hint=""
                    android:paddingLeft="10dp"
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:minHeight="40dp"
                android:orientation="horizontal"
                android:paddingTop="5dp"
                android:paddingBottom="5dp"
                android:weightSum="1">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.4"
                    android:text="Reason detail"
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />

                <TextView
                    android:id="@+id/txtRemarks"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.6"
                    android:background="@color/btn_login_bg"
                    android:gravity="center_vertical"
                    android:hint=""
                    android:minHeight="60dp"
                    android:paddingLeft="10dp"
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:minHeight="40dp"
                android:orientation="horizontal"
                android:paddingTop="5dp"
                android:paddingBottom="5dp"
                android:weightSum="1">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.4"
                    android:gravity="center_vertical"
                    android:minHeight="40dp"
                    android:text="Product name"
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />

                <TextView
                    android:id="@+id/txtPartNo"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_margin="2.5dp"
                    android:layout_weight="0.2"
                    android:background="@color/btn_login_bg"
                    android:gravity="center_vertical"
                    android:hint=""
                    android:minHeight="40dp"
                    android:padding="5dp"
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />

                <TextView
                    android:id="@+id/txtPartDesc"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="5dp"
                    android:layout_weight="0.4"
                    android:background="@color/btn_login_bg"
                    android:gravity="center_vertical"
                    android:hint=""
                    android:minHeight="40dp"
                    android:padding="5dp"
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:minHeight="40dp"
                android:orientation="horizontal"
                android:paddingTop="5dp"
                android:paddingBottom="5dp"
                android:weightSum="1">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.4"
                    android:text="Raised date &amp; time"
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />

                <TextView
                    android:id="@+id/txtFromDate"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_margin="2.5dp"
                    android:layout_marginRight="10dp"
                    android:layout_weight="0.3"
                    android:background="@color/btn_login_bg"
                    android:gravity="center_vertical"
                    android:hint=""
                    android:minHeight="40dp"
                    android:padding="5dp"
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />

                <TextView
                    android:id="@+id/txtFromTime"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.3"
                    android:background="@color/btn_login_bg"
                    android:gravity="center_vertical"
                    android:hint=""
                    android:minHeight="40dp"
                    android:padding="5dp"
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />


            </LinearLayout>

            <LinearLayout
                android:id="@+id/layoutUserCloserRemrk"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:minHeight="40dp"
                android:orientation="horizontal"
                android:paddingTop="5dp"
                android:paddingBottom="5dp"
                android:visibility="gone"
                android:weightSum="1">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.4"
                    android:text="User closer remark"
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />

                <TextView
                    android:id="@+id/txtUserCloserRemark"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.6"
                    android:background="@color/btn_login_bg"
                    android:gravity="center_vertical"
                    android:hint=""
                    android:minHeight="60dp"
                    android:paddingLeft="10dp"
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />

            </LinearLayout>

            <LinearLayout
                android:id="@+id/layoutFromDate"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:minHeight="40dp"
                android:orientation="horizontal"
                android:paddingTop="5dp"
                android:paddingBottom="5dp"
                android:visibility="gone"
                android:weightSum="1">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.4"
                    android:text="User closer date &amp; time"
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />

                <TextView
                    android:id="@+id/txtUserCloserFromDate"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_margin="2.5dp"
                    android:layout_marginRight="10dp"
                    android:layout_weight="0.6"
                    android:background="@color/btn_login_bg"
                    android:gravity="center_vertical"
                    android:hint=""
                    android:minHeight="40dp"
                    android:padding="5dp"
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />


            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:minHeight="40dp"
                android:orientation="horizontal"
                android:paddingTop="5dp"
                android:paddingBottom="5dp"
                android:weightSum="1">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.4"
                    android:text="Raised by"
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />

                <TextView
                    android:id="@+id/txtRaisedBy"
                    android:layout_width="0dp"
                    android:layout_height="40dp"
                    android:layout_weight="0.6"
                    android:background="@color/btn_login_bg"
                    android:gravity="center_vertical"
                    android:hint=""
                    android:paddingLeft="10dp"
                    android:textColor="@color/colorPrimaryDark"
                    android:textSize="@dimen/text_size_normal" />

            </LinearLayout>

            <!-- <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:gravity="center_vertical"
                 android:minHeight="40dp"
                 android:orientation="horizontal"
                 android:paddingTop="5dp"
                 android:paddingBottom="5dp"
                 android:weightSum="1">

                 <TextView
                     android:layout_width="0dp"
                     android:layout_height="wrap_content"
                     android:layout_weight="0.4"
                     android:text="Final closer remark"
                     android:textColor="@color/colorPrimaryDark"
                     android:textSize="@dimen/text_size_normal" />

                 <TextView
                     android:id="@+id/txtFinalCloserRemark"
                     android:layout_width="0dp"
                     android:layout_height="wrap_content"
                     android:layout_weight="0.6"
                     android:background="@color/btn_login_bg"
                     android:gravity="center_vertical"
                     android:hint=""
                     android:minHeight="60dp"
                     android:paddingLeft="10dp"
                     android:textColor="@color/colorPrimaryDark"
                     android:textSize="@dimen/text_size_normal" />

             </LinearLayout>-->


            <android.support.v7.widget.RecyclerView
                android:id="@+id/chat_recycler_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_above="@id/btnNext"
                android:layout_marginTop="10dp"
                android:orientation="vertical"
                android:scrollbars="none"/>


        </LinearLayout>

    </android.support.v4.widget.NestedScrollView>

</RelativeLayout>

Я получаю ошибку, которая описана ниже -

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.secure.linestoppage.code/com.secure.linestoppage.code.activity.CloseFormActivity}: android.view.InflateException: Binary XML file line #25: Binary XML file line #25: Error inflating class android.support.v4.widget.NestedScrollView
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2895)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1616)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:176)
        at android.app.ActivityThread.main(ActivityThread.java:6651)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)
     Caused by: android.view.InflateException: Binary XML file line #25: Binary XML file line #25: Error inflating class android.support.v4.widget.NestedScrollView
     Caused by: android.view.InflateException: Binary XML file line #25: Error inflating class android.support.v4.widget.NestedScrollView
     Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.widget.NestedScrollView" on path: DexPathList[[zip file "/data/app/com.secure.linestoppage.code-tZmMTvK6UILKj74NGTfn8g==/base.apk"],nativeLibraryDirectories=[/data/app/com.secure.linestoppage.code-tZmMTvK6UILKj74NGTfn8g==/lib/arm64, /system/lib64, /system/vendor/lib64]]
...