为什么图片滑动不连续显示?

Why image sliding not display consecutive?

HashMap<String,Integer> file_maps = new HashMap<String, Integer>();

        file_maps.put("M/S 1",R.drawable.rs1);
        file_maps.put("M/S 2",R.drawable.rs2);
        file_maps.put("M/S 3",R.drawable.rs3);
        file_maps.put("M/S 4",R.drawable.rs4);


        for(String name : file_maps.keySet()){
            TextSliderView textSliderView = new TextSliderView(this);
            // initialize a SliderLayout
            textSliderView
                    .description(name)
                    .image(file_maps.get(name))
                    .setScaleType(BaseSliderView.ScaleType.Fit)
                    .setOnSliderClickListener(this);

mDemoSlider.addSlider(textSliderView);

我使用此代码,假设出现的第一张图片是 rs1,第二张是 rs2,第三张是 rs3,最后一张是 rs4 ..

但问题是图像 rs3 将首先显示,第二个 rs4,第三个 rs1 和最后一个 rs2 ..

那么我该如何解决这个问题呢?或者知道为什么会发生这个问题..?

而不是

  HashMap file_maps = new HashMap();

使用

  HashMap file_maps = new LinkedHashMap();

HashMap makes absolutely no guarantees about the iteration order. It can (and will) even change completely when new elements are added.

LinkedHashMap will iterate in the order in which the entries were put into the map