没有滚动时,Recyclerview页脚位于屏幕底部;滚动时,列表底部位于Recyclerview页脚 [英] Recyclerview footer at bottom of screen when no scroll AND at end of the list when it has scroll

查看:292
本文介绍了没有滚动时,Recyclerview页脚位于屏幕底部;滚动时,列表底部位于Recyclerview页脚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,所有屏幕(对于具有滚动功能的屏幕)在滚动结束时都具有商标页脚,而在无滚动时,屏幕底部具有静态页脚.

In my application I have branding footer at the end of scroll on all screens (for screens which have scroll) and static at bottom of the screen when(no scroll).

但是我要解决的问题是通过带有列表的屏幕来实现.我正在使用recyclerview显示列表.我想在滚动的recyclerview末尾显示品牌页脚,并且在底部滚动时将可见.这可以通过带有页脚的Recyclerview实现.

But I am facing issues to achieve this with screen which has list. I am using recyclerview for showing list. I want to show Branding Footer at end of the recyclerview when it has scroll and it will be visible when it is scrolled at the bottom. This is achievable with Recyclerview with footer.

但是,当recyclerview没有滚动(列表中的项目很少)时,我希望页脚固定在屏幕底部.

But when recyclerview does not have scroll (when few items in list), I want footer fixed at bottom of the screen.

提前谢谢!

推荐答案

该问题似乎与其他几个问题相似,与此问题相关的大多数堆栈溢出帖子都指向使用itemdecoration实现此目的(通过添加itemdecoration所需的高度)

The question appears similar to several other, most of the stack overflow posts related to this question point towards the usage of itemdecoration to achieve this (By adding itemdecoration of the desired height)

一种实现此目的的方法是预先确定回收站视图的高度,然后使用该信息为与回收站视图相关的项装饰中的页脚设置偏移量

One way of achieving this would be to determine the height of the recycler view beforehand and then using that information to set the offset for the footer in the itemdecoration associated with the recycle view

这可能会有所帮助:如何在recyclerview中实现粘性页脚

这篇关于没有滚动时,Recyclerview页脚位于屏幕底部;滚动时,列表底部位于Recyclerview页脚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆