daimajia / AndroidImageSlider

An amazing and convenient Android image slider.
MIT License
5.63k stars 1.66k forks source link

pageIndicator size issue #321

Open nikitamarysoloman opened 7 years ago

nikitamarysoloman commented 7 years ago

Not able to change the size of the indicator even by using sliderLayout.getPagerIndicator().setDefaultIndicatorSize(10,10, PagerIndicator.Unit.DP); The size of the indicator is changing after sliding to next page
I have tried even sliderLayout.getPagerIndicator().setDefaultSelectedIndicatorSize(10,10, PagerIndicator.Unit.DP); sliderLayout.getPagerIndicator().setDefaultUnselectedIndicatorSize(10,10, PagerIndicator.Unit.DP); still not fixed plz suggest some solution. here is my code : Hash_file_maps.put("1",R.drawable.img1); Hash_file_maps.put("2",R.drawable.img2); Hash_file_maps.put("3",R.drawable.img3); Hash_file_maps.put("4",R.drawable.img4); Hash_file_maps.put("5",R.drawable.img5); // Hash_file_maps.put("6",R.drawable.img6); // Hash_file_maps.put("7",R.drawable.img7); for(String name : Hash_file_maps.keySet()){ TextSliderView textSliderView = new TextSliderView(LoginActivity.this); textSliderView .description(null) .image(Hash_file_maps.get(name)) .setScaleType(BaseSliderView.ScaleType.Fit) .setOnSliderClickListener(this); textSliderView.bundle(new Bundle()); textSliderView.getBundle() .putString("extra",name);

        sliderLayout.addSlider(textSliderView);
    }
    sliderLayout.setPresetTransformer(SliderLayout.Transformer.Default);
    sliderLayout.setSliderTransformDuration(250,null);
    sliderLayout.getPagerIndicator().setDefaultUnselectedIndicatorSize(10,10, PagerIndicator.Unit.DP);
    sliderLayout.setPresetIndicator(SliderLayout.PresetIndicators.Center_Top);
    sliderLayout.getPagerIndicator().setDefaultIndicatorSize(10,10, PagerIndicator.Unit.DP);
   sliderLayout.getPagerIndicator().setDefaultSelectedIndicatorSize(10,10, PagerIndicator.Unit.DP);
   sliderLayout.getPagerIndicator().setDefaultUnselectedIndicatorSize(10,10,PagerIndicator.Unit.DP);
    sliderLayout.getPagerIndicator().setPadding(0,80,0,0);
    sliderLayout.setDuration(3500);
    sliderLayout.addOnPageChangeListener(this);
halilozel1903 commented 4 years ago

I'm pulling data from the API.

You can show the size of the incoming data in the slider.

Example 👍

textSliderView = new TextSliderView(view.getContext()); textSliderView .title(mainBoardItemP.getContent().getName()) .description(mainBoardItemP.getContent().getMetadata().getSummary_short()) .image(mainBoardItemP.getContent().getYatayPoster().getUrl()) .setScaleType(BaseSliderView.ScaleType.CenterCrop)

@nikitamarysoloman you should try :)