Android 개발 문제 의 사용 ScrollView

문제 가 생기다.
Exception raised during rendering: ScrollView can host only one direct child
번역렌 더 링 중 이상 던 지기:ScrollView 는 직접 하위 세대 만 위탁 관리 할 수 있 습 니 다.
해결 방안:
여러 레이아웃 을 하나의 layot 에 넣 습 니 다. 그리고 바깥쪽 은 ScrollView. 
이전 코드 변경:
<LinearLayout
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:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.yoolink.ui.fragment.trade.wechatpay.Trade2Fragment">

        <LinearLayout style="@style/bmItem_lin_all">

            <LinearLayout
                android:id="@+id/bm_1"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_jiaofei" />

            LinearLayout>

            <LinearLayout
                android:id="@+id/bm_2"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_wechat" />

            LinearLayout>
        LinearLayout>

        <LinearLayout style="@style/bmItem_lin_all">

            <LinearLayout
                android:id="@+id/bm_3"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="     " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_hcp" />

            LinearLayout>

            <LinearLayout
                android:id="@+id/bm_4"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="     " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_zfb" />

            LinearLayout>
        LinearLayout>

        <LinearLayout style="@style/bmItem_lin_all">

            <LinearLayout
                android:id="@+id/bm_5"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="     " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_fjp" />

            LinearLayout>

            <LinearLayout
                android:id="@+id/bm_6"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="     " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_xyk" />

            LinearLayout>
        LinearLayout>

        <LinearLayout style="@style/bmItem_lin_all">

            <LinearLayout
                android:id="@+id/bm_7"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_dy" />

            LinearLayout>

            <LinearLayout
                android:id="@+id/bm_8"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_yxcz" />

            LinearLayout>
        LinearLayout>

        <LinearLayout style="@style/bmItem_lin_all">

            <LinearLayout
                android:id="@+id/bm_9"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_sjcz" />

            LinearLayout>

            <LinearLayout
                android:id="@+id/bm_10"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_cpgm" />

            LinearLayout>
        LinearLayout>

        <LinearLayout style="@style/bmItem_lin_all">

            <LinearLayout
                android:id="@+id/bm_11"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_jdyd" />

            LinearLayout>

            <LinearLayout
                android:id="@+id/bm_12"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_jtwz" />

            LinearLayout>
        LinearLayout>

        <LinearLayout style="@style/bmItem_lin_all">

            <LinearLayout
                android:id="@+id/bm_13"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_bxlc" />

            LinearLayout>

        LinearLayout>
LinearLayout>
수정 후:
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:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.yoolink.ui.fragment.trade.wechatpay.Trade2Fragment">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/movie_background"
        android:orientation="vertical">

        <LinearLayout style="@style/bmItem_lin_all">

            <LinearLayout
                android:id="@+id/bm_1"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_jiaofei" />

            LinearLayout>

            <LinearLayout
                android:id="@+id/bm_2"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_wechat" />

            LinearLayout>
        LinearLayout>

        <LinearLayout style="@style/bmItem_lin_all">

            <LinearLayout
                android:id="@+id/bm_3"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="     " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_hcp" />

            LinearLayout>

            <LinearLayout
                android:id="@+id/bm_4"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="     " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_zfb" />

            LinearLayout>
        LinearLayout>

        <LinearLayout style="@style/bmItem_lin_all">

            <LinearLayout
                android:id="@+id/bm_5"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="     " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_fjp" />

            LinearLayout>

            <LinearLayout
                android:id="@+id/bm_6"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="     " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_xyk" />

            LinearLayout>
        LinearLayout>

        <LinearLayout style="@style/bmItem_lin_all">

            <LinearLayout
                android:id="@+id/bm_7"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_dy" />

            LinearLayout>

            <LinearLayout
                android:id="@+id/bm_8"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_yxcz" />

            LinearLayout>
        LinearLayout>

        <LinearLayout style="@style/bmItem_lin_all">

            <LinearLayout
                android:id="@+id/bm_9"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_sjcz" />

            LinearLayout>

            <LinearLayout
                android:id="@+id/bm_10"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_cpgm" />

            LinearLayout>
        LinearLayout>

        <LinearLayout style="@style/bmItem_lin_all">

            <LinearLayout
                android:id="@+id/bm_11"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_jdyd" />

            LinearLayout>

            <LinearLayout
                android:id="@+id/bm_12"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_jtwz" />

            LinearLayout>
        LinearLayout>

        <LinearLayout style="@style/bmItem_lin_all">

            <LinearLayout
                android:id="@+id/bm_13"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_bxlc" />

            LinearLayout>

            <LinearLayout
                android:id="@+id/bm_14"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_yhjy" />

            LinearLayout>
        LinearLayout>

        <LinearLayout style="@style/bmItem_lin_all">

            <LinearLayout
                android:id="@+id/bm_15"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_jzbj" />

            LinearLayout>

            <LinearLayout
                android:id="@+id/bm_16"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_jdwx" />

            LinearLayout>
        LinearLayout>

        <LinearLayout style="@style/bmItem_lin_all">

            <LinearLayout
                android:id="@+id/bm_17"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_fwzl" />

            LinearLayout>

            <LinearLayout
                android:id="@+id/bm_18"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_xcby" />

            LinearLayout>
        LinearLayout>

        <LinearLayout style="@style/bmItem_lin_all">

            <LinearLayout
                android:id="@+id/bm_19"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_kdfw" />

            LinearLayout>

            <LinearLayout
                android:id="@+id/bm_20"
                style="@style/bmItem_lin">

                                    style="@style/bmItem_text"
                    android:text="       " />

                                    style="@style/bmItem_img"
                    android:src="@drawable/bm_spsy" />

            LinearLayout>
        LinearLayout>
    LinearLayout>

좋은 웹페이지 즐겨찾기