mardi 26 janvier 2016

Random Flipping of View

i am realy new with Android Code. I try to show a random Image on my Layout. With the Code below the first Image after onCread is random. But after that the others are in Order. Is there a way to show after every View a random other view ?

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {


        View rootView = inflater.inflate(R.layout.fragment_home, container, false);

            mViewFlipper = (ViewFlipper) rootView.findViewById(R.id.view_flipper);
            mViewFlipper.setAutoStart(true);
            mViewFlipper.setFlipInterval(4000);
            Random mRandom = new Random();
            mViewFlipper.setDisplayedChild(mRandom.nextInt(400));
            mViewFlipper.startFlipping();



Aucun commentaire:

Enregistrer un commentaire