Onboarding
介绍:
一个漂亮的引导界面,模仿了500px。
运行效果:
使用说明:
使用一个普通的ViewPager和一个带回调的自定义transformer就能实现这种效果。
Interface
public interface SceneChangeListener {
void enterScene(@Nullable ImageView sharedElement, float position);
void centerScene(@Nullable ImageView sharedElement);
void exitScene(@Nullable ImageView sharedElement, float position);
void notInScene();
}
然后是一个实现了响应movement回调的fragment类
Fragment
public abstract class BaseSceneFragment extends Fragment
implements SceneTransformer.SceneChangeListener {
protected static final String KEY_POSITION = "KEY_POSITION";
// we have to set a position tag to the root layout of every scene fragment
// this is so the transformer will know who to make a callback to
protected void setRootPositionTag(@NonNull View root) {
root.setTag(getArguments().getInt(KEY_POSITION));
}
@Override
public abstract void enterScene(@Nullable ImageView sharedElement, float position);
@Override
public abstract void centerScene(@Nullable ImageView sharedElement);
@Override
public abstract void exitScene(@Nullable ImageView sharedElement, float position);
@Override
public abstract void notInScene();
...
}
已下载
0