조각에서 RecyclerView와 함께 SwipeRefreshLayout을 사용하고 있습니다.RecyclerView가 조각에서 SwipeRefreshLayout과 함께 작동하지 않습니다.
RecyclerView가 아래로 스크롤되지 않습니다. 이건 내 주요 활동의 레이아웃입니다
이 잘 작동
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<include
layout="@layout/toolbar" />
<!-- Replaced with Fragment -->
<LinearLayout
android:id="@+id/fragment_placeholder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/main_menu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:layout_gravity="start"
android:background="@color/white"
android:scrollbars="vertical"
/>
</android.support.v4.widget.DrawerLayout>
- 조각 위치 문제가 RecyclerView와 함께 위에서 볼 수있는 ID의 fragment_placeholder로있는 LinearLayout을 대체합니다.
조각 레이아웃은 여기에 있습니다 :
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/swipe_refresh_layout">
<android.support.v7.widget.RecyclerView
android:id="@+id/content_recycler_view"
android:layout_width="match_parent
android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
슬쩍 - 새로 고침 - 제스처는 잘 작동하지만, RecyclerView의 내용이 화면 크기를 초과하는 경우, 스크롤이 작동하지 않습니다.
nestedScrollingEnabled (true)를 설정하려고했지만 작동하지 않습니다.
RecyclerView dataView = (RecyclerView) layout.findViewById(R.id.content_recycler_view);
final RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
dataView.setLayoutManager(mLayoutManager);
adapter = new ListContentAdapter();
dataView.setAdapter(adapter);
dataView.setNestedScrollingEnabled(true);
나는 RecyclerView 주위에 NestedScrollView를 감싸는 경우는, 스크롤 것 :
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/swipe_refresh_layout">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:id="@+id/content_recycler_view"
android:layout_width="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_height="match_parent" />
</android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
을하지만 그것의 의견을 재사용의 RecyclerView의 장점을 파괴한다. 왜 스크롤하지 않습니까?
도움 주셔서 감사합니다.
예 Nestedscrollview를 추가 한 후에는 고마워, 근무 것! –