У меня есть NestedScrollView, а внутри него родительский линейный макет, который также содержит обзор переработчика.
Вот мой код XML:
<?xml version="1.0" encoding="utf-8"?>
<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:id="@+id/mainLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_alpha_main"
android:orientation="vertical">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:visibility="visible"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="10dp"
android:visibility="visible">
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Welcome"
android:textColor="@color/colorPrimary" />
<TextView
android:id="@+id/userName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorPrimary"
android:textSize="22sp"
android:textStyle="bold"
tools:text="Hi User" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/logoutBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_marginTop="2dp"
android:background="?attr/selectableItemBackground"
android:padding="5dp"
app:srcCompat="@drawable/ic_logout" />
<TextView
android:id="@+id/versionCode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:gravity="center"
android:paddingEnd="2dp"
android:textSize="12sp"
android:textStyle="bold"
tools:text="v1.5" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:orientation="horizontal">
<TextView
android:id="@+id/newheader"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:text="@string/news_feed"
android:textColor="@color/colorBlack"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/refereshBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="?attr/selectableItemBackground"
android:drawableStart="@drawable/ic_refresh"
android:drawablePadding="5dp"
android:gravity="center_vertical"
android:text="Refresh"
android:textColor="@color/blue_selector"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="300dp">
<TextView
android:id="@+id/newFeedNoDataTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginStart="10dp"
android:text="No Data Found"
android:textColor="@color/colorRed"
android:textSize="18sp"
android:textStyle="bold"
android:visibility="gone" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/newFeedRv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="gone"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/newsfeed_items" />
<com.github.demono.AutoScrollViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:stopWhenTouch="false" />
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="gone" />
<!-- <cn.trinea.android.view.autoscrollviewpager.AutoScrollViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="wrap_content" />-->
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="@string/menu"
android:textColor="@color/colorBlack"
android:textSize="18sp"
android:textStyle="bold" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/serviceRv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:isScrollContainer="false"
android:nestedScrollingEnabled="false"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="2"
tools:listitem="@layout/services_item" />
<androidx.cardview.widget.CardView
android:id="@+id/knowledgeShareCardView"
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_marginStart="10dp"
android:layout_marginTop="30dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="10dp"
app:cardCornerRadius="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_alpha_knowledgeshare"
android:orientation="vertical">
<TextView
android:id="@+id/serviceTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="50dp"
android:gravity="center"
android:text="Knowledge Share"
android:textColor="@color/colorBlack"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="@+id/serviceSubTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:textColor="@color/darkGray"
tools:text="Administrator" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>
Я попытался установить ViewCompat.setNestedScrollingEnabled (serviceRv,false), но это не сработало, а также я попытался поместить родительский объект linear в представление scrollview, сохранив его nestedScroll = false. Кто-нибудь может подсказать, в чем проблема с макетом?