【发布时间】:2016-06-23 20:14:49
【问题描述】:
我正在为我的应用程序中的图表使用 MPAndroid 图表。每当用户进入此图表的视图时,我都想为图表设置动画。
我有两个图表,用户可以在它们之间滑动。现在的问题是,每当我从一个视图滑动到另一个视图时,图表会在短时间内可见,然后开始制作动画。这种行为使动画看起来很糟糕。
每当用户看到视图时,我启动动画的代码就是这个。我还为需要帮助的地方写了一个 TODO。
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser) {
if (mBarChart != null) {
mBarChart.animateY(2000);
}
} else {
if(mBarChart != null) {
// TODO: Set Back Animation so the bars will be invisible when swiping back to the view
}
}
}
【问题讨论】: