0

I am using GlideSlider(https://github.com/firdausmaulan/GlideSlider) for creating an image slider in my app. I am using an example from that author (https://github.com/firdausmaulan/GlideSlider-Example) But facing 2 problems.

  1. Can't Fit the image, as you can see in the image attached.
  2. I don't want the Description level. the animation used for the description layout disables the description layout and then it pops up again. Is there any way to completely disable it?

MainActivity ::

 @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mDemoSlider = findViewById(R.id.slider);

    ArrayList<String> listUrl = new ArrayList<>();
    ArrayList<String> listName = new ArrayList<>();
    HashMap<String,Integer> file_maps = new HashMap<String, Integer>();
    file_maps.put("Hannibal",R.drawable.slider1);
    file_maps.put("Big Bang Theory",R.drawable.slider2);
    file_maps.put("House of Cards",R.drawable.slider3);
    file_maps.put("Game of Thrones", R.drawable.slider4);

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

                .setOnSliderClickListener(this);

        //add your extra information
        textSliderView.bundle(new Bundle());
        textSliderView.getBundle()
                .putString("extra",name);

        mDemoSlider.addSlider(textSliderView);
    }
    mDemoSlider.setPresetTransformer(SliderLayout.Transformer.Default);
    mDemoSlider.setPresetIndicator(SliderLayout.PresetIndicators.Center_Bottom);
    mDemoSlider.setCustomAnimation(new DescriptionAnimation());
    mDemoSlider.setDuration(4000);
    mDemoSlider.addOnPageChangeListener(this);

}

XML File::

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.glide.slider.example.MainActivity">

<com.glide.slider.library.SliderLayout
    android:id="@+id/slider"

    android:layout_width="match_parent"
    android:layout_height="200dp" />

Note:: and is there any other image slider Library that I can use easily?

enter image description here

AskNilesh
  • 67,701
  • 16
  • 123
  • 163
Ananna Rahman
  • 165
  • 1
  • 10

0 Answers0