Scrollview внутри Scrollview с RecyclerView не прокручивается - PullRequest
0 голосов
/ 26 июня 2018

Я использовал один родительский вид прокрутки, и в этом я использовал дочерний вид прокрутки с двумя видами перезапуска. Я использовал множество решений, чтобы применить прокрутку к дочернему обзору прокрутки, но не смог этого сделать.

основной макет приведен ниже

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/bid_root_rl"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/background_color">

    <include
        android:id="@+id/appbar"
        layout="@layout/toolbar" />

    <TextView
        android:id="@+id/txt_msg"
        style="@style/error_textview_style"
        android:layout_below="@+id/appbar" />

    <ScrollView
        android:id="@+id/scrollView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/llLast"
        android:layout_below="@+id/txt_msg"
        android:fillViewport="true"
        android:fitsSystemWindows="true"
        android:scrollbarThumbVertical="@drawable/scrollbar_thumb_color">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <LinearLayout
                android:id="@+id/ll1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:weightSum="1">

                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:layout_weight="0.5"
                    android:background="@color/color_wallet_background"
                    android:padding="@dimen/dimen_10dp">

                    <TextView
                        android:id="@+id/tvBTCWalletBalance"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_centerVertical="true"
                        android:layout_marginLeft="@dimen/dimen_2dp"
                        android:layout_marginStart="@dimen/dimen_2dp"
                        android:layout_toEndOf="@id/ic_deposit"
                        android:layout_toRightOf="@id/ic_deposit"
                        android:text="09999"
                        android:textColor="@color/white"
                        android:textSize="@dimen/textSizeInvoiceBuy"
                        android:textStyle="bold" />


                    <com.ebitcoinics.ebitcoinicsapp.customview_virtual_currency.CustomVirtualCurrencyImageViewWhiteColor
                        android:id="@+id/localImageView"
                        android:layout_width="@dimen/imageSizeTooSmallBTCLogoForMin"
                        android:layout_height="@dimen/imageSizeTooSmallBTCLogoForMin"
                        android:layout_centerVertical="true"
                        android:layout_marginLeft="@dimen/dimen_2dp"
                        android:layout_marginStart="@dimen/dimen_2dp"
                        android:layout_toEndOf="@id/tvBTCWalletBalance"
                        android:layout_toRightOf="@id/tvBTCWalletBalance" />

                    <ImageView
                        android:id="@+id/ic_deposit"
                        android:layout_width="@dimen/imageSizeTooSmallBTCLogoForMin"
                        android:layout_height="@dimen/imageSizeTooSmallBTCLogoForMin"
                        android:layout_alignParentLeft="true"
                        android:layout_alignParentStart="true"
                        android:layout_centerVertical="true"
                        android:layout_marginLeft="@dimen/dimen_2dp"
                        android:layout_marginStart="@dimen/dimen_2dp"
                        android:src="@drawable/ic_deposit" />

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_centerVertical="true"
                        android:layout_marginLeft="@dimen/dimen_2dp"
                        android:layout_marginStart="@dimen/dimen_2dp"
                        android:layout_toEndOf="@+id/localImageView"
                        android:layout_toRightOf="@+id/localImageView"
                        android:orientation="horizontal">

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_vertical"
                            android:text="("
                            android:textColor="@color/white"
                            android:textSize="@dimen/bid_ask_current_trades_size"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/tvPriceAsPerBuy"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_vertical"
                            android:layout_marginLeft="@dimen/dimen_2dp"
                            android:layout_marginStart="@dimen/dimen_2dp"
                            android:textColor="@color/white"
                            android:textSize="@dimen/bid_ask_current_trades_size"
                            android:textStyle="bold" />

                        <com.ebitcoinics.ebitcoinicsapp.customview_local_currency.CustomLocalCurrencyImageViewWhiteColor
                            android:id="@+id/imgLocalCurrencyAsPerWallet"
                            android:layout_width="@dimen/imageSizeTooSmallBTCLogoForMin"
                            android:layout_height="@dimen/imageSizeTooSmallBTCLogoForMin"
                            android:layout_gravity="center_vertical"
                            android:layout_marginLeft="@dimen/dimen_2dp"
                            android:layout_marginStart="@dimen/dimen_2dp" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_vertical"
                            android:layout_marginLeft="@dimen/dimen_2dp"
                            android:layout_marginStart="@dimen/dimen_2dp"
                            android:text=")"
                            android:textColor="@color/white"
                            android:textSize="@dimen/bid_ask_current_trades_size"
                            android:textStyle="bold" />
                    </LinearLayout>

                </RelativeLayout>

                <View
                    android:layout_width="@dimen/dimen_1dp"
                    android:layout_height="match_parent"
                    android:background="@color/white" />

                <LinearLayout
                    android:id="@+id/txt_buy_info_ll2"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:layout_weight="0.5"
                    android:background="@color/color_wallet_background"
                    android:padding="@dimen/dimen_10dp">

                    <include
                        android:id="@+id/ll_buy_info"
                        layout="@layout/include_layout_buy_new" />
                </LinearLayout>


            </LinearLayout>


            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/ll1"
                android:layout_margin="@dimen/dimen_10dp"
                android:orientation="vertical">

                <LinearLayout
                    android:id="@+id/ll2"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <include
                        android:id="@+id/llTop"
                        layout="@layout/common_edittext_header_for_bid_ask_new" />
                </LinearLayout>

                <include
                    android:id="@+id/activity_market_rates"
                    layout="@layout/activity_market_rates_inner_layout_ask"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" />
            </LinearLayout>


        </RelativeLayout>

    </ScrollView>

    <LinearLayout
        android:id="@+id/llLast"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:orientation="vertical">

        <TextView
            android:id="@+id/txt1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="@string/ask_rules"
            android:textColor="@color/white"
            android:textSize="@dimen/textSizeTooMin" />

        <TextView
            android:id="@+id/txtMsgBidAsk"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/dimen_5dp"
            android:gravity="center"
            android:text="@string/BidAskMsg"
            android:textColor="@color/white"
            android:textSize="@dimen/textSizeTooMin"
            android:textStyle="italic" />

        <android.support.v7.widget.AppCompatButton
            android:id="@+id/btn_ask"
            style="@style/button_style"
            android:layout_marginBottom="@dimen/dimen_10dp"
            android:layout_marginLeft="@dimen/dimen_10dp"
            android:layout_marginRight="@dimen/dimen_10dp"
            android:text="@string/ask" />
    </LinearLayout>
</RelativeLayout>

activity_market_rates_inner_layout_ask.xml указан ниже

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">


<LinearLayout
    android:id="@+id/rlTitle"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="@dimen/dimen_3dp"
    android:orientation="horizontal"
    android:weightSum="1">

    <ProgressBar
        android:id="@+id/progressBar"
        style="@style/Widget.AppCompat.ProgressBar.Horizontal"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="0.1"
        android:background="@drawable/progress_drawable"
        android:indeterminate="false"
        android:max="100"
        android:visibility="invisible" />

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="0.9"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/txtLocal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center_horizontal"
            android:text="@string/localPrice"
            android:textColor="@color/white"
            android:textSize="@dimen/bid_ask_current_trades_size" />

        <TextView
            android:id="@+id/txtVirtual"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center_horizontal"
            android:text="@string/localPrice"
            android:textColor="@color/white"
            android:textSize="@dimen/bid_ask_current_trades_size" />

        <TextView
            android:id="@+id/txtRate"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center_horizontal"
            android:text="@string/ratePrice"
            android:textColor="@color/white"
            android:textSize="@dimen/bid_ask_current_trades_size" />
    </LinearLayout>
</LinearLayout>

<RelativeLayout
    android:id="@+id/rlProgress"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/rlTitle"
    android:layout_gravity="center"
    android:visibility="gone">

    <ProgressBar
        android:id="@+id/progressBar2"

        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:background="@drawable/progress_color"
        android:indeterminate="true" />
</RelativeLayout>

<ScrollView
    android:id="@+id/scrollViewChild"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/rlTitle"
    android:fillViewport="true"
    android:fitsSystemWindows="true"
    android:scrollbarThumbVertical="@drawable/scrollbar_thumb_color">

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

        <android.support.v7.widget.RecyclerView
            android:id="@+id/rvSell"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />


        <android.support.v7.widget.RecyclerView
            android:id="@+id/rvBuy"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/dimen_5dp" />
    </LinearLayout>
</ScrollView>

здесь я хочу прокрутить scrollViewChild, я использовал

rvSell.setNestedScrollingEnabled(false);
 rvBuy.setNestedScrollingEnabled(false);

Но только родительский скролл прокручивает, а не дочерний.

Ответы [ 2 ]

0 голосов
/ 26 июня 2018

В вашем внутреннем XML, попробуйте:

<android.support.v7.widget.RecyclerView
            android:id="@+id/rvSell"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" 
            android:overScrollMode="never"/>


<android.support.v7.widget.RecyclerView
            android:id="@+id/rvBuy"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/dimen_5dp" 
            android:nestedScrollingEnabled="false"/>
0 голосов
/ 26 июня 2018

попробуйте это:

 recycler.setLayoutManager(new LinearLayoutManager(linear_.getContext(),
            LinearLayoutManager.VERTICAL, false){
        @Override
        public boolean canScrollHorizontally() {
            return false;
        }

        @Override
        public boolean canScrollVertically() {
            return false;
        }
    });

и вместо ScrollView используйте NestedScrollView

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...