如何取决于同级滚动型滚动位置的一个观点的内容同步? [英] How to synchronize content of one view depending on scroll position in sibling ScrollView?

查看:157
本文介绍了如何取决于同级滚动型滚动位置的一个观点的内容同步?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经扩展的LinearLayout(垂直),以创建一个自定义组合部件。这反过来有两个孩子:

I have extended LinearLayout (vertical) to create a custom compound component. This in turn contains two children:


  • 是直接绘制在画布视图一个自定义视图。

  • 一个Horizo​​ntalScrollView-> LinearView(水平) - >多个自定义视图

我现在想重新绘制自定义视图,以匹配滚动视图的可见内容即可。这样做的原因是,长在滚动视图的定制组件的阵列主要静态和合适的要绘制的时间提前,而在顶视图应该是高度动态的,并涉及到任何东西都是在滚动视图中可见。

I would now like to redraw the custom view to match the visible contents of the scroll view. The reason for this is that the long array of custom components in the scroll view are mainly static and suitable to be drawn ahead of time, while the top view is supposed to be highly dynamic and relate to whatever things are visible in the scroll view.

我希望我做的问题/想法有所明确。我不是ATT所有自信,这是最好的办法,而且我的听觉享受的替代解决方案有什么建议或也许就如何触发一个重绘事件的一些想法,每次在Horizo​​ntalScrollView滚动位置的变化。

I hope I made the problem/idea somewhat clear. I am not att all confident this is the best approach, and I'd enjoy hearing any suggestions on alternative solutions or perhaps some idea on how to trigger a redraw-event everytime the scroll position changes in the HorizontalScrollView.

感谢!

推荐答案

您可以有你的活动听滚动视图适配器。在适配器当过滚动位置更改您在活动执行委托。
这样的活动可以在滚动视图的变化更新的意见其余部分。

You can have your activity listen to the scroll view adapter. in the adapter when ever the scroll position changes you execute the delegate in the Activity. That way the activity can update the rest of the views upon scroll view change.

这篇关于如何取决于同级滚动型滚动位置的一个观点的内容同步?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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