If do handing, we should get Animation Class via VewFlipper#getInAnimation().
We register to Listener.
The follow code is sample.
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_flashing_card, null);
        mVewFlipper = (ViewFlipper) view.findViewById(R.id.viewFlipper1);
        mVewFlipper.setAutoStart(true);
        mVewFlipper.setInAnimation(getActivity(), android.R.anim.slide_in_left);
        mVewFlipper.getInAnimation().setAnimationListener(this);
        mVewFlipper.setFlipInterval(2000);
        return view;
    }
    @Override
    public void onAnimationEnd(Animation animation) {
    }
    @Override
    public void onAnimationRepeat(Animation animation) {
    }
    @Override
    public void onAnimationStart(Animation animation) {
    }
 
No comments:
Post a Comment