NestedScrollView内的粘页脚(或AppBarLayout的背面)

时间:2019-10-15 17:06:40

标签: android android-coordinatorlayout android-appbarlayout android-nestedscrollview

我想在NestedScrollView中放一个页脚。我有以下设置:

<android.support.design.widget.CoordinatorLayout>

    <android.support.design.widget.AppBarLayout>
        <android.support.v7.widget.Toolbar/>
    </android.support.design.widget.AppBarLayout>

    <NestedScrollView>
      <LinearLayout>
        <TextView/>
        <FooterView/>
      </LinearLayout>
    </NestedScrollView>
</android.support.design.widget.CoordinatorLayout>

TextView只是一个例子。想象它是一个长内容,它使NestedScrollView可滚动。当前,FooterView与其他内容一起上下滚动。我想要的是: -它始终位于屏幕底部(如反向Toolbar)。这意味着,如果NestedScrollView内容很短,则它仍应位于屏幕底部。
-向下滚动NestedScrollView时,它在底部保持粘性。

现在,我正在想象这完全是AppBarLayout's的行为,但是方向相反。您是否知道以这种方式运行的视图,或者可以为我提供如何实现这种行为的指导?

作为参考,我附上了AppBarLayout的行为,但我的看法却相反: enter image description here

请注意,蓝色Toolbar和黄色TextViewAppBarLayout的一部分,AppBarLayoutTextView滚动,同时保持{{1} }位于顶部。

0 个答案:

没有答案