當我嘗試圍繞Google在其開發者社區支持中使用的邏輯圍繞我的大腦時,它使我瘋狂地開始拉扯我的頭髮(幸運地我是禿頂)。 我的意思是人們會期望谷歌正在間接提倡作爲其根容器的小部件NSV,可以與其他幾乎普遍使用的小部件recyclerview一起使用。那麼NestedScrollView和Recyclerview一起使用的判決是什麼?
這是如何跨越他們的想法超越了我。在API22令我們感到困惑之後,谷歌仍然沒有解決它們之間的問題。
我很抱歉浪費非生產性的咆哮。
我有什麼
我猜nothign將是新來的,因爲幾乎每個人都用甩掙扎裏面nestedscrollview得到了相同的設置來完成着想I.然而,這是我的觀點的支架。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical">
<android.support.design.widget.CoordinatorLayout
tools:ignore="RtlHardcoded">
<android.support.design.widget.AppBarLayout
>
<android.support.design.widget.CollapsingToolbarLayout
>
<View
></View>
<android.support.v7.widget.Toolbar
android:id="@id/tool_bar"
/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="100dp" />
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"></android.support.v7.widget.RecyclerView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<com.roughike.bottombar.BottomBar
android:id="@+id/bottom_navigation_bar"
/>
</android.support.design.widget.CoordinatorLayout>
</LinearLayout>
問題 簡單! 。 RV應該WAI。當它停下來時,它應該拋起並停下來。在NSV的視野之下,雖然RV不會飛起來,但只要手指擡起,它就會停下來。
思考
哪這麼短的時間在我手上(客戶端總是這樣),以及所涉及的recyclerview和NSV滾動過程中,我實在是沒有動力多拿一支蠟燭,走進之間可能殘酷的技術性下面的陰影。
然而我跑出了選項,並控制+點擊RV。有人說這個問題與佈局經理有關。
我會在這裏發佈,如果我希望拿出一個解決方案。如果您有任何問題,請在這裏發表您的想法。
recyclerView.setHasFixedSize(false);我按照你的建議嘗試了這個。工作它沒有。 :| –
你添加了nestedScrollingEnabled = true嗎? –
nestedscrollingenabled是一個非常差的方法。它將完整的數據集加載到RV中並殺死回收。如果我在數據集中有一千行,它會加載所有這些行。這也會導致無盡的滾動問題。不幸的是,它不是一個選項 –