How to get ViewFlipper's current child position

后端 未结 4 1183
刺人心
刺人心 2021-02-12 01:40

I have added a bunch of images to a ViewFlipper and now I am performing an onClick event in the flipper. For this I would like to know the current child position so that I can p

4条回答
  •  梦谈多话
    2021-02-12 01:54

    In addflipperimages(ViewFlipper flipper) method you are adding bunch of images to ViewFlipper for that you are creating imageview, set tag to imageview, set imageview clickable true then write onclick method to imageview. go through the fallowing code it may works for you
    here ids[] is an array of image ids

    private void addFlipperImages(ViewFlipper flipper) {
    
            int imageCount = ids.length;
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.FILL_PARENT,
                RelativeLayout.LayoutParams.FILL_PARENT);
    
        for (int count = 0; count 

提交回复
热议问题