【发布时间】:2014-09-20 14:53:42
【问题描述】:
我正在尝试修复 ScrollView 中的某个项目,当它击中 ActionBar 时。 它正确停止,但是当我返回主滚动位置时,我在布局上方得到一个随机边距(屏幕截图 3)。 (截图2中的边距不是bug)
我的 ObservableScrollView 监听器
if(t > stackHeight && !animationActionBarstackedBg){
animationActionBarstackedBg = true;
} else if (t < stackHeight && animationActionBarstackedBg){
animationActionBarstackedBg = false;
}
frameImg.setPadding(frameImg.getPaddingLeft(), t/2, frameImg.getPaddingRight(), frameImg.getPaddingBottom());
if(animationActionBarstackedBg){
panelTitleContainer.setPadding(panelTitleContainer.getPaddingLeft(), t-stackHeight, panelTitleContainer.getPaddingRight(), panelTitleContainer.getPaddingBottom());
}
其中 t 是 ScrollY,stackHeight 是图像高度,frameImg 是一个 FrameLayout,其中包含一个 ImageView(用于制作类似 Google I/O 2014 的动画),而 panelTitleContainer 是一个包含棕色布局的布局。
有办法修复滚动视图中的项目吗?
【问题讨论】:
标签: android scrollview material-design googleio